1 package org
.argeo
.slc
.client
.ui
.dist
.commands
;
3 import javax
.jcr
.Repository
;
4 import javax
.jcr
.RepositoryException
;
5 import javax
.jcr
.Session
;
7 import org
.argeo
.jcr
.JcrUtils
;
8 import org
.argeo
.slc
.SlcException
;
9 import org
.argeo
.slc
.client
.ui
.dist
.DistPlugin
;
10 import org
.argeo
.slc
.client
.ui
.dist
.wizards
.ChangeRightsWizard
;
11 import org
.eclipse
.core
.commands
.AbstractHandler
;
12 import org
.eclipse
.core
.commands
.ExecutionEvent
;
13 import org
.eclipse
.core
.commands
.ExecutionException
;
14 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
15 import org
.eclipse
.jface
.wizard
.WizardDialog
;
16 import org
.eclipse
.ui
.handlers
.HandlerUtil
;
18 /** Open a dialog to manage rights on the current workspace's root node */
19 public class ManageWorkspaceAuth
extends AbstractHandler
{
20 // private static final Log log =
21 // LogFactory.getLog(ManageWorkspaceAuth.class);
22 public final static String ID
= DistPlugin
.PLUGIN_ID
23 + ".manageWorkspaceAuth";
24 public final static String DEFAULT_LABEL
= "Manage Rights";
25 public final static ImageDescriptor DEFAULT_ICON
= DistPlugin
26 .getImageDescriptor("icons/changeRights.gif");
28 public final static String PARAM_WORKSPACE_NAME
= DistPlugin
.PLUGIN_ID
31 /* DEPENDENCY INJECTION */
32 private Repository repository
;
33 private Session session
;
35 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
36 String workspaceName
= event
.getParameter(PARAM_WORKSPACE_NAME
);
38 session
= repository
.login(workspaceName
);
39 ChangeRightsWizard wizard
= new ChangeRightsWizard(session
);
40 WizardDialog dialog
= new WizardDialog(
41 HandlerUtil
.getActiveShell(event
), wizard
);
44 } catch (RepositoryException re
) {
45 throw new SlcException("Cannot log in the repository "
46 + repository
+ " in workspace " + workspaceName
, re
);
48 JcrUtils
.logoutQuietly(session
);
52 /* DEPENDENCY INJECTION */
53 public void setRepository(Repository repository
) {
54 this.repository
= repository
;