]> git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.security.ui.admin/src/org/argeo/security/ui/admin/commands/NewGroup.java
41672d5b6498c9651b88775d5f67694690cd2f71
[lgpl/argeo-commons.git] / org.argeo.security.ui.admin / src / org / argeo / security / ui / admin / commands / NewGroup.java
1 /*
2 * Copyright (C) 2007-2012 Argeo GmbH
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16 package org.argeo.security.ui.admin.commands;
17
18 import org.argeo.security.ui.admin.SecurityAdminPlugin;
19 import org.eclipse.core.commands.AbstractHandler;
20 import org.eclipse.core.commands.ExecutionEvent;
21 import org.eclipse.core.commands.ExecutionException;
22 import org.eclipse.jface.dialogs.MessageDialog;
23 import org.eclipse.ui.handlers.HandlerUtil;
24 import org.osgi.service.useradmin.UserAdmin;
25
26 /** Create a new group. */
27 public class NewGroup extends AbstractHandler {
28 public final static String ID = SecurityAdminPlugin.PLUGIN_ID + ".newGroup";
29
30 private UserAdmin userAdmin;
31
32 public Object execute(ExecutionEvent event) throws ExecutionException {
33
34 MessageDialog
35 .openError(HandlerUtil.getActiveShell(event),
36 "Unimplemented method",
37 "Group creation is not yet implemented");
38 return null;
39 }
40
41 /* DEPENDENCY INJECTION */
42 public void setUserAdmin(UserAdmin userAdmin) {
43 this.userAdmin = userAdmin;
44 }
45 }
46
47 // JcrRolesView rolesView = (JcrRolesView) HandlerUtil
48 // .getActiveWorkbenchWindow(event).getActivePage()
49 // .findView(JcrRolesView.ID);
50 // String role = rolesView.getNewRole();
51 // if (role.trim().equals(""))
52 // return null;
53 // if (role.equals(rolesView.getAddNewRoleText()))
54 // return null;
55 // role = role.trim().toUpperCase();
56 // if (!role.startsWith(rolePrefix))
57 // role = rolePrefix + role;
58 // if (userAdminService.listEditableRoles().contains(role))
59 // throw new ArgeoException("Role " + role + " already exists");
60 // userAdminService.newRole(role);
61 // rolesView.refresh();
62 //
63 // // refresh editors
64 // IEditorReference[] refs = HandlerUtil.getActiveWorkbenchWindow(event)
65 // .getActivePage()
66 // .findEditors(null, JcrArgeoUserEditor.ID, IWorkbenchPage.MATCH_ID);
67 // for (IEditorReference ref : refs) {
68 // JcrArgeoUserEditor userEditor = (JcrArgeoUserEditor) ref.getEditor(false);
69 // if (userEditor != null) {
70 // userEditor.refresh();
71 // }
72 // }
73 // return null;
74 // }
75 //
76 // public void setUserAdminService(UserAdminService userAdminService) {
77 // this.userAdminService = userAdminService;
78 // }
79 //
80 // }