2 * Copyright (C) 2007-2012 Argeo GmbH
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org
.argeo
.slc
.client
.ui
.dist
.commands
;
18 import javax
.jcr
.Repository
;
19 import javax
.jcr
.RepositoryException
;
20 import javax
.jcr
.Session
;
22 import org
.argeo
.ArgeoException
;
23 import org
.argeo
.slc
.client
.ui
.dist
.DistPlugin
;
24 import org
.argeo
.slc
.client
.ui
.dist
.wizards
.ChangeRightsWizard
;
25 import org
.eclipse
.core
.commands
.AbstractHandler
;
26 import org
.eclipse
.core
.commands
.ExecutionEvent
;
27 import org
.eclipse
.core
.commands
.ExecutionException
;
28 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
29 import org
.eclipse
.jface
.wizard
.WizardDialog
;
30 import org
.eclipse
.ui
.handlers
.HandlerUtil
;
33 * Open a dialog to change rights on the root node of the current workspace.
36 public class ManageWorkspaceAuth
extends AbstractHandler
{
37 // private static final Log log =
38 // LogFactory.getLog(ManageWorkspaceAuth.class);
39 public final static String ID
= DistPlugin
.ID
+ ".manageWorkspaceAuth";
40 public final static String PARAM_WORKSPACE_NAME
= DistPlugin
.ID
42 public final static String DEFAULT_LABEL
= "Manage Rights";
43 // public final static String DEFAULT_ICON_PATH = "icons/changeRights.gif";
44 public final static ImageDescriptor DEFAULT_ICON
= DistPlugin
45 .getImageDescriptor("icons/changeRights.gif");
48 /* DEPENDENCY INJECTION */
49 private Repository repository
;
51 private Session session
;
53 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
54 String workspaceName
= event
.getParameter(PARAM_WORKSPACE_NAME
);
56 session
= repository
.login(workspaceName
);
57 ChangeRightsWizard wizard
= new ChangeRightsWizard(session
);
58 WizardDialog dialog
= new WizardDialog(
59 HandlerUtil
.getActiveShell(event
), wizard
);
62 } catch (RepositoryException re
) {
63 throw new ArgeoException(
64 "Unexpected error while creating the new workspace.", re
);
71 /* DEPENDENCY INJECTION */
72 public void setRepository(Repository repository
) {
73 this.repository
= repository
;