+ fix bugs for workspace CRUD commands introduced with multi-repo management
authorBruno Sinou <bsinou@argeo.org>
Fri, 8 Mar 2013 18:23:46 +0000 (18:23 +0000)
committerBruno Sinou <bsinou@argeo.org>
Fri, 8 Mar 2013 18:23:46 +0000 (18:23 +0000)
+ fix a few single sourcing issues

git-svn-id: https://svn.argeo.org/slc/trunk@6116 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

plugins/org.argeo.slc.client.ui.dist/META-INF/spring/commands.xml
plugins/org.argeo.slc.client.ui.dist/plugin.xml
plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/commands/CopyWorkspace.java
plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/commands/DeleteWorkspace.java
plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/commands/NormalizeDistribution.java
plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/BundleDetailsPage.java
plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/editors/DistributionOverviewPage.java
plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/views/DistributionsView.java

index b5cf3fc0ba22651273df6b24ec8a187b0a9de68c..ec6176f1a247bfadad91f513e2bf0e490a2b30b1 100644 (file)
                <property name="workspace" value="org.argeo.tp-1.3.1" />
        </bean>
 
-       <bean id="normalizeDistribution"
-               class="org.argeo.slc.client.ui.dist.commands.NormalizeDistribution"
-               scope="prototype">
-               <property name="repository" ref="javaRepository" />
-       </bean>
        <bean id="fetch" class="org.argeo.slc.client.ui.dist.commands.Fetch"
                scope="prototype">
                <property name="repositoryFactory" ref="repositoryFactory" />
                <property name="nodeRepository" ref="nodeRepository" />
        </bean>
 
-       <bean id="copyWorkspace" class="org.argeo.slc.client.ui.dist.commands.CopyWorkspace"
-               scope="prototype">
-               <property name="repository" ref="javaRepository" />
-       </bean>
        <bean id="manageWorkspaceAuth"
                class="org.argeo.slc.client.ui.dist.commands.ManageWorkspaceAuth"
                scope="prototype">
index 8521a2271b1414fb251e7346c5b5d43f900d0da2..b8867213102031abe7ed6977adc4ee4f3dae018e 100644 (file)
             defaultHandler="org.argeo.slc.client.ui.dist.commands.DeleteWorkspace"
             name="Delete chosen Workspace">
        </command>
+       <command
+            id="org.argeo.slc.client.ui.dist.normalizeDistribution"
+            defaultHandler="org.argeo.slc.client.ui.dist.commands.NormalizeDistribution"
+            name="Normalize Distribution">
+       </command>
+               <command
+            id="org.argeo.slc.client.ui.dist.copyWorkspace"
+            defaultHandler="org.argeo.slc.client.ui.dist.commands.CopyWorkspace"
+            name="Copy chosen Workspace">
+       </command>
+       
        <command
             defaultHandler="org.argeo.slc.client.ui.dist.commands.ShowSizeColumn"
             id="org.argeo.slc.client.ui.dist.showSizeColumn"
                        name="Remote Repo path">
                        </commandParameter>
        </command>
-               
                <command
             id="org.argeo.slc.client.ui.dist.runInOSGi"
             defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
                        id="workspace"
                        name="Workspace Name">
                        </commandParameter>
-       </command>
-               <command
-            id="org.argeo.slc.client.ui.dist.normalizeDistribution"
-            defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
-            name="Normalize Distribution">
-            <commandParameter
-                       id="workspace"
-                       name="Workspace Name">
-                       </commandParameter>
        </command>
                <command
             id="org.argeo.slc.client.ui.dist.registerRepository"
        </command>
        
                <!-- TO MANIPULATE WORKSPACES -->
-               <command
-            id="org.argeo.slc.client.ui.dist.copyWorkspace"
-            defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
-            name="Copy chosen Workspace">
-            <commandParameter
-                       id="org.argeo.slc.client.ui.dist.workspaceName"
-                       name="Workspace Name">
-                       </commandParameter>
-       </command>
        <command
             id="org.argeo.slc.client.ui.dist.manageWorkspaceAuth"
             defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
index eee669dfa6a828f9f632c7ca2e1122692254ec0b..2711694621c7d14c16b3a3d18889f50ca34ba688 100644 (file)
  */
 package org.argeo.slc.client.ui.dist.commands;
 
+import javax.jcr.Credentials;
 import javax.jcr.Node;
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
+import javax.jcr.security.Privilege;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.argeo.ArgeoException;
+import org.argeo.jcr.JcrUtils;
 import org.argeo.slc.client.ui.dist.DistPlugin;
 import org.argeo.slc.client.ui.dist.utils.CommandHelpers;
+import org.argeo.slc.client.ui.dist.views.DistributionsView;
+import org.argeo.slc.client.ui.dist.views.DistributionsView.DistributionViewSelectedElement;
 import org.argeo.slc.repo.RepoUtils;
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.IWorkbenchWindow;
 
 /**
@@ -37,49 +41,51 @@ import org.eclipse.ui.IWorkbenchWindow;
  */
 
 public class CopyWorkspace extends AbstractHandler {
-       private static final Log log = LogFactory.getLog(CopyWorkspace.class);
+       // private static final Log log = LogFactory.getLog(CopyWorkspace.class);
        public final static String ID = DistPlugin.ID + ".copyWorkspace";
-       public final static String PARAM_WORKSPACE_NAME = DistPlugin.ID
-                       + ".workspaceName";
        public final static String DEFAULT_LABEL = "Duplicate";
        public final static String DEFAULT_ICON_PATH = "icons/addItem.gif";
 
-       /* DEPENDENCY INJECTION */
        private Repository repository;
+       private Credentials credentials;
+       private String wkspName;
+       private String slcRole = "ROLE_SLC";
 
        public Object execute(ExecutionEvent event) throws ExecutionException {
-               String srcWorkspaceName = event.getParameter(PARAM_WORKSPACE_NAME);
-
-               if (log.isTraceEnabled())
-                       log.debug("WORKSPACE " + srcWorkspaceName + " About to be copied");
-
-               // MessageDialog.openWarning(DistPlugin.getDefault()
-               // .getWorkbench().getDisplay().getActiveShell(),
-               // "WARNING", "Not yet implemented");
-               // return null;
-
                IWorkbenchWindow iww = DistPlugin.getDefault().getWorkbench()
                                .getActiveWorkbenchWindow();
+               IWorkbenchPart view = iww.getActivePage().getActivePart();
+               if (view instanceof DistributionsView) {
+                       DistributionViewSelectedElement dvse = ((DistributionsView) view)
+                                       .getSelectedElement();
+                       if (dvse != null && (dvse.isWorkspace)) {
+                               repository = dvse.repository;
+                               credentials = dvse.credentials;
+                               wkspName = dvse.wkspName;
+                       }
+               }
+               if (repository == null || wkspName == null)
+                       return null;
+
                InputDialog inputDialog = new InputDialog(iww.getShell(),
-                               "New copy of the current workspace",
+                               "New copy of workspace " + wkspName,
                                "Choose a name for the workspace to create", "", null);
                inputDialog.open();
                String newWorkspaceName = inputDialog.getValue();
                Session srcSession = null;
                Session newSession = null;
                try {
-                       srcSession = repository.login(srcWorkspaceName);
+                       srcSession = repository.login(credentials, wkspName);
 
                        // Create the workspace
                        srcSession.getWorkspace().createWorkspace(newWorkspaceName);
                        Node srcRootNode = srcSession.getRootNode();
                        // log in the newly created workspace
-                       newSession = repository.login(newWorkspaceName);
-                       // newSession.save();
+                       newSession = repository.login(credentials, newWorkspaceName);
                        Node newRootNode = newSession.getRootNode();
                        RepoUtils.copy(srcRootNode, newRootNode);
                        newSession.save();
-
+                       JcrUtils.addPrivilege(newSession, "/", slcRole, Privilege.JCR_ALL);
                        CommandHelpers.callCommand(RefreshDistributionsView.ID);
                } catch (RepositoryException re) {
                        throw new ArgeoException(
index 0d4ce6f029968e8dd7b4809e810b307ca0454f49..dd016268923267a5768c235f8c8ea4d12c300b0f 100644 (file)
@@ -56,7 +56,6 @@ public class DeleteWorkspace extends AbstractHandler {
 
                IWorkbenchWindow iww = DistPlugin.getDefault().getWorkbench()
                                .getActiveWorkbenchWindow();
-
                IWorkbenchPart view = iww.getActivePage().getActivePart();
                if (view instanceof DistributionsView) {
                        DistributionViewSelectedElement dvse = ((DistributionsView) view)
index 433d7b67f29b0d876e22cb917fe3378c08f1a8fc..f8be4d8444531eeadc86230941354e125135eb92 100644 (file)
@@ -16,6 +16,7 @@
 package org.argeo.slc.client.ui.dist.commands;
 
 import javax.jcr.Binary;
+import javax.jcr.Credentials;
 import javax.jcr.Node;
 import javax.jcr.NodeIterator;
 import javax.jcr.Property;
@@ -36,6 +37,8 @@ import org.argeo.slc.NameVersion;
 import org.argeo.slc.SlcException;
 import org.argeo.slc.aether.AetherUtils;
 import org.argeo.slc.client.ui.dist.DistPlugin;
+import org.argeo.slc.client.ui.dist.views.DistributionsView;
+import org.argeo.slc.client.ui.dist.views.DistributionsView.DistributionViewSelectedElement;
 import org.argeo.slc.jcr.SlcNames;
 import org.argeo.slc.jcr.SlcTypes;
 import org.argeo.slc.repo.ArtifactIndexer;
@@ -63,6 +66,8 @@ import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.handlers.HandlerUtil;
 import org.sonatype.aether.artifact.Artifact;
 import org.sonatype.aether.util.artifact.DefaultArtifact;
@@ -70,7 +75,6 @@ import org.sonatype.aether.util.artifact.DefaultArtifact;
 /** Make sure than Maven and OSGi metadata are consistent */
 public class NormalizeDistribution extends AbstractHandler implements SlcNames {
        public final static String ID = DistPlugin.ID + ".normalizeDistribution";
-       public final static String PARAM_WORKSPACE = "workspace";
        public final static String DEFAULT_LABEL = "Normalize...";
        public final static String DEFAULT_ICON_PATH = "icons/normalize.gif";
 
@@ -78,13 +82,30 @@ public class NormalizeDistribution extends AbstractHandler implements SlcNames {
                        .getLog(NormalizeDistribution.class);
 
        private Repository repository;
+       private Credentials credentials;
+       private String wkspName;
        private String artifactBasePath = "/";
 
        private ArtifactIndexer artifactIndexer = new ArtifactIndexer();
        private JarFileIndexer jarFileIndexer = new JarFileIndexer();
 
        public Object execute(ExecutionEvent event) throws ExecutionException {
-               String workspace = event.getParameter(PARAM_WORKSPACE);
+
+               IWorkbenchWindow iww = DistPlugin.getDefault().getWorkbench()
+                               .getActiveWorkbenchWindow();
+               IWorkbenchPart view = iww.getActivePage().getActivePart();
+               if (view instanceof DistributionsView) {
+                       DistributionViewSelectedElement dvse = ((DistributionsView) view)
+                                       .getSelectedElement();
+                       if (dvse != null && (dvse.isWorkspace)) {
+                               repository = dvse.repository;
+                               credentials = dvse.credentials;
+                               wkspName = dvse.wkspName;
+                       }
+               }
+               if (repository == null || wkspName == null)
+                       return null;
+
                NormalizationDialog dialog = new NormalizationDialog(
                                HandlerUtil.getActiveShell(event));
                if (dialog.open() != Dialog.OK)
@@ -95,10 +116,10 @@ public class NormalizeDistribution extends AbstractHandler implements SlcNames {
 
                NormalizeJob job;
                try {
-                       job = new NormalizeJob(repository.login(workspace), version,
-                                       overridePoms);
+                       job = new NormalizeJob(repository.login(credentials, wkspName),
+                                       version, overridePoms);
                } catch (RepositoryException e) {
-                       throw new SlcException("Cannot normalize " + workspace, e);
+                       throw new SlcException("Cannot normalize " + wkspName, e);
                }
                job.setUser(true);
                job.schedule();
@@ -348,4 +369,4 @@ public class NormalizeDistribution extends AbstractHandler implements SlcNames {
                }
 
        }
-}
+}
\ No newline at end of file
index 269466083b12240c64b6d559d859d506d3b11edb..dc605e67e7be8a393829650c8f25e8c2c126b4e3 100644 (file)
@@ -115,7 +115,11 @@ public class BundleDetailsPage extends FormPage implements SlcNames, SlcTypes {
                createField(details, "Symbolic name", SlcNames.SLC_SYMBOLIC_NAME);
                createField(details, "Version", SlcNames.SLC_BUNDLE_VERSION);
                createField(details, "Group Id", SlcNames.SLC_GROUP_ID);
-               //createHyperlink(details, "Licence", DistConstants.SLC_BUNDLE_LICENCE);
+               // Single sourcing issue: this does not works with rap
+               // createHyperlink(details, "Licence",
+               // DistConstants.SLC_BUNDLE_LICENCE);
+               createField(details, "Licence", DistConstants.SLC_BUNDLE_LICENCE);
+
                createField(details, "Vendor", DistConstants.SLC_BUNDLE_VENDOR);
 
        }
index eb14ae8cbf2cf5fc89e12ed10e1aa0271660fdad..403617654b0c443a5d04f4b09eaefa08e9ccce47 100644 (file)
@@ -34,8 +34,10 @@ import javax.jcr.query.qom.Selector;
 import javax.jcr.query.qom.StaticOperand;
 
 import org.argeo.ArgeoException;
-import org.argeo.eclipse.ui.ErrorFeedback;
+import org.argeo.ArgeoMonitor;
+import org.argeo.eclipse.ui.EclipseArgeoMonitor;
 import org.argeo.jcr.JcrUtils;
+import org.argeo.slc.SlcException;
 import org.argeo.slc.client.ui.dist.DistConstants;
 import org.argeo.slc.client.ui.dist.DistImages;
 import org.argeo.slc.client.ui.dist.DistPlugin;
@@ -44,6 +46,10 @@ import org.argeo.slc.client.ui.dist.utils.CommandHelpers;
 import org.argeo.slc.client.ui.dist.utils.NodeViewerComparator;
 import org.argeo.slc.jcr.SlcNames;
 import org.argeo.slc.jcr.SlcTypes;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.jface.action.IMenuListener;
 import org.eclipse.jface.action.IMenuManager;
 import org.eclipse.jface.action.MenuManager;
@@ -94,8 +100,7 @@ public class DistributionOverviewPage extends FormPage implements SlcNames {
        private Text artifactTxt;
        private FormToolkit tk;
        private Composite header;
-
-       // private Section headerSection;
+       private final static String FILTER_HELP_MSG = "Enter filter criterion separated by a space";
 
        public DistributionOverviewPage(FormEditor formEditor, String title,
                        Session session) {
@@ -103,6 +108,41 @@ public class DistributionOverviewPage extends FormPage implements SlcNames {
                this.session = session;
        }
 
+       private void asynchronousRefresh() {
+               refreshFilteredList();
+               // FIXME Does not work yet: how can the job set the viewer input ?
+               // RefreshJob job = new RefreshJob(session, artifactTxt.getText());
+               // job.setUser(true);
+               // job.schedule();
+               // viewer.setInput(nodes);
+       }
+
+       private class RefreshJob extends Job {
+               private Session session;
+               private List<Node> nodes;
+               private String filter;
+
+               public RefreshJob(Session session, String filter, List<Node> nodes) {
+                       super("Get bundle list");
+                       this.session = session;
+               }
+
+               @Override
+               protected IStatus run(IProgressMonitor progressMonitor) {
+                       try {
+                               ArgeoMonitor monitor = new EclipseArgeoMonitor(progressMonitor);
+                               monitor.beginTask("Getting bundle list", -1);
+                               List<Node> result = JcrUtils
+                                               .nodeIteratorToList(listBundleArtifacts(session, filter));
+                               nodes.addAll(result);
+                       } catch (Exception e) {
+                               return new Status(IStatus.ERROR, DistPlugin.ID,
+                                               "Cannot get bundle list", e);
+                       }
+                       return Status.OK_STATUS;
+               }
+       }
+
        @Override
        protected void createFormContent(IManagedForm managedForm) {
                ScrolledForm form = managedForm.getForm();
@@ -117,12 +157,10 @@ public class DistributionOverviewPage extends FormPage implements SlcNames {
                createFilterPart(body);
                // Add the table
                createTableViewer(body);
-
-               viewer.setInput(session);
-               resetFilter();
-
+               viewer.setInput(null);
                // Add a listener to enable custom resize process
                form.addControlListener(new ControlListener() {
+                       // form.addListener(SWT.RESIZE, new Listener() does not work
                        public void controlResized(ControlEvent e) {
                                refreshLayout();
                        }
@@ -130,20 +168,11 @@ public class DistributionOverviewPage extends FormPage implements SlcNames {
                        public void controlMoved(ControlEvent e) {
                        }
                });
-
-               // This below doesn not work; the listener must be added as a control
-               // listener to be correctly notified when resize events happen
-
-               // form.addListener(SWT.RESIZE, new Listener() {
-               // public void handleEvent(Event event) {
-               // log.debug("Form resized ....");
-               // }
-               // });
-
+               asynchronousRefresh();
        }
 
        /** Build repository request */
-       private NodeIterator listBundleArtifacts(Session session)
+       private NodeIterator listBundleArtifacts(Session session, String filter)
                        throws RepositoryException {
                QueryManager queryManager = session.getWorkspace().getQueryManager();
                QueryObjectModelFactory factory = queryManager.getQOMFactory();
@@ -168,10 +197,9 @@ public class DistributionOverviewPage extends FormPage implements SlcNames {
                                                "%.source"))));
 
                // Build constraints based the textArea content
-               String artifactTxtVal = artifactTxt.getText();
-               if (!"".equals(artifactTxtVal.trim())) {
+               if (filter != null && !"".equals(filter.trim())) {
                        // Parse the String
-                       String[] strs = artifactTxtVal.trim().split(" ");
+                       String[] strs = filter.trim().split(" ");
                        for (String token : strs) {
                                token = token.replace('*', '%');
                                StaticOperand so = factory.literal(session.getValueFactory()
@@ -220,13 +248,16 @@ public class DistributionOverviewPage extends FormPage implements SlcNames {
 
                // Text Area to filter
                artifactTxt = tk.createText(header, "", SWT.BORDER | SWT.SINGLE);
+               artifactTxt.setMessage(FILTER_HELP_MSG);
                gd = new GridData(SWT.FILL, SWT.FILL, false, false);
                gd.grabExcessHorizontalSpace = true;
                artifactTxt.setLayoutData(gd);
                artifactTxt.addModifyListener(new ModifyListener() {
-
                        public void modifyText(ModifyEvent event) {
-                               refreshFilteredList();
+                               if ("".equals(artifactTxt.getText().trim()))
+                                       asynchronousRefresh();
+                               else
+                                       refreshFilteredList();
                        }
                });
 
@@ -246,12 +277,18 @@ public class DistributionOverviewPage extends FormPage implements SlcNames {
 
        private void resetFilter() {
                artifactTxt.setText("");
-               artifactTxt.setMessage("Enter filter criterion separated by a space");
-               viewer.refresh();
+               artifactTxt.setMessage(FILTER_HELP_MSG);
        }
 
        private void refreshFilteredList() {
-               viewer.refresh();
+               List<Node> nodes;
+               try {
+                       nodes = JcrUtils.nodeIteratorToList(listBundleArtifacts(session,
+                                       artifactTxt.getText()));
+                       viewer.setInput(nodes);
+               } catch (RepositoryException e) {
+                       throw new SlcException("Unable to list bundles", e);
+               }
        }
 
        private void createTableViewer(Composite parent) {
@@ -340,21 +377,18 @@ public class DistributionOverviewPage extends FormPage implements SlcNames {
 
        /** force refresh of the artifact list */
        public void refresh() {
-               viewer.refresh();
+               asynchronousRefresh();
        }
 
        /** Programmatically configure the context menu */
        protected void contextMenuAboutToShow(IMenuManager menuManager) {
                IWorkbenchWindow window = DistPlugin.getDefault().getWorkbench()
                                .getActiveWorkbenchWindow();
-
                // Build conditions
-
                // Delete selected artifacts
                CommandHelpers.refreshCommand(menuManager, window, DeleteArtifacts.ID,
                                DeleteArtifacts.DEFAULT_LABEL,
                                DeleteArtifacts.DEFAULT_ICON_PATH, true);
-
        }
 
        private SelectionAdapter getSelectionAdapter(final int index) {
@@ -380,24 +414,21 @@ public class DistributionOverviewPage extends FormPage implements SlcNames {
        /* LOCAL CLASSES */
        private class DistributionsContentProvider implements
                        IStructuredContentProvider {
-               // private Session session;
+               // we keep a cache of the Nodes in the content provider to be able to
+               // manage long request
+               private List<Node> nodes;
 
                public void dispose() {
                }
 
+               // We expect a list of nodes as a new input
+               @SuppressWarnings("unchecked")
                public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-                       // session = (Session) newInput;
+                       nodes = (List<Node>) newInput;
                }
 
                public Object[] getElements(Object arg0) {
-                       try {
-                               List<Node> nodes = JcrUtils
-                                               .nodeIteratorToList(listBundleArtifacts(session));
-                               return nodes.toArray();
-                       } catch (RepositoryException e) {
-                               ErrorFeedback.show("Cannot list bundles", e);
-                               return null;
-                       }
+                       return nodes.toArray();
                }
        }
 
index 140b7d4896c581ce141a50b350f9adabb36e8865..458df44a997138540511226b0e375c005a0502d4 100644 (file)
@@ -226,7 +226,6 @@ public class DistributionsView extends ViewPart implements SlcNames, ArgeoNames
 
                if (firstElement instanceof TreeParent
                                || firstElement instanceof BrowserElem) {
-                       String wsName = null;
                        String targetRepoPath = null;
 
                        // Build conditions depending on element type
@@ -236,7 +235,6 @@ public class DistributionsView extends ViewPart implements SlcNames, ArgeoNames
                        if (firstElement instanceof DistributionElem) {
                                DistributionElem de = (DistributionElem) firstElement;
                                isDistribElem = true;
-                               wsName = de.getName();
                                isReadOnly = de.isReadOnly();
                        } else if (firstElement instanceof RepoElem) {
                                RepoElem re = (RepoElem) firstElement;
@@ -292,21 +290,17 @@ public class DistributionsView extends ViewPart implements SlcNames, ArgeoNames
                                        isRepoElem && singleElement && !isReadOnly, params);
 
                        // Normalize workspace
-                       params = new HashMap<String, String>();
-                       params.put(NormalizeDistribution.PARAM_WORKSPACE, wsName);
-                       CommandHelpers.refreshParameterizedCommand(menuManager, window,
+                       CommandHelpers.refreshCommand(menuManager, window,
                                        NormalizeDistribution.ID,
                                        NormalizeDistribution.DEFAULT_LABEL,
                                        NormalizeDistribution.DEFAULT_ICON_PATH, isDistribElem
-                                                       && singleElement && !isReadOnly, params);
+                                                       && singleElement && !isReadOnly);
 
                        // Copy workspace
-                       params = new HashMap<String, String>();
-                       params.put(CopyWorkspace.PARAM_WORKSPACE_NAME, wsName);
-                       CommandHelpers.refreshParameterizedCommand(menuManager, window,
+                       CommandHelpers.refreshCommand(menuManager, window,
                                        CopyWorkspace.ID, CopyWorkspace.DEFAULT_LABEL,
                                        CopyWorkspace.DEFAULT_ICON_PATH, isDistribElem
-                                                       && singleElement, params);
+                                                       && singleElement);
 
                        // Clear Workspace
                        CommandHelpers.refreshCommand(menuManager, window,