]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - org.argeo.security.ui.admin/src/org/argeo/security/ui/admin/commands/DeleteRole.java
Work on user and group editors. Comment out legacy code that use old userAdminService
[lgpl/argeo-commons.git] / org.argeo.security.ui.admin / src / org / argeo / security / ui / admin / commands / DeleteRole.java
index 7648e26180caa216b6c26499a3583a3e935fe5a4..a8db0eb8e205077f35366664e3d3a36a92c695cf 100644 (file)
  */
 package org.argeo.security.ui.admin.commands;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
 import org.argeo.security.UserAdminService;
-import org.argeo.security.ui.admin.views.JcrRolesView;
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.handlers.HandlerUtil;
 
 /** Deletes the selected roles */
 public class DeleteRole extends AbstractHandler {
@@ -35,38 +26,45 @@ public class DeleteRole extends AbstractHandler {
 
        @SuppressWarnings("unchecked")
        public Object execute(ExecutionEvent event) throws ExecutionException {
-               ISelection selection = HandlerUtil.getCurrentSelection(event);
-               if (selection.isEmpty())
-                       return null;
-
-               List<String> toDelete = new ArrayList<String>();
-               Iterator<String> it = ((IStructuredSelection) selection).iterator();
-               while (it.hasNext()) {
-                       toDelete.add(it.next());
-               }
-
-               if (!MessageDialog
-                               .openQuestion(
-                                               HandlerUtil.getActiveShell(event),
-                                               "Delete Role",
-                                               "Are you sure that you want to delete "
-                                                               + toDelete
-                                                               + "?\n"
-                                                               + "This may lead to inconsistencies in the application."))
-                       return null;
-
-               for (String role : toDelete) {
-                       userAdminService.deleteRole(role);
-               }
-
-               JcrRolesView view = (JcrRolesView) HandlerUtil
-                               .getActiveWorkbenchWindow(event).getActivePage()
-                               .findView(JcrRolesView.ID);
-               view.refresh();
                return null;
        }
 
        public void setUserAdminService(UserAdminService userAdminService) {
                this.userAdminService = userAdminService;
        }
-}
\ No newline at end of file
+}
+// ISelection selection = HandlerUtil.getCurrentSelection(event);
+// if (selection.isEmpty())
+// return null;
+//
+// List<String> toDelete = new ArrayList<String>();
+// Iterator<String> it = ((IStructuredSelection) selection).iterator();
+// while (it.hasNext()) {
+// toDelete.add(it.next());
+// }
+//
+// if (!MessageDialog
+// .openQuestion(
+// HandlerUtil.getActiveShell(event),
+// "Delete Role",
+// "Are you sure that you want to delete "
+// + toDelete
+// + "?\n"
+// + "This may lead to inconsistencies in the application."))
+// return null;
+//
+// for (String role : toDelete) {
+// userAdminService.deleteRole(role);
+// }
+//
+// JcrRolesView view = (JcrRolesView) HandlerUtil
+// .getActiveWorkbenchWindow(event).getActivePage()
+// .findView(JcrRolesView.ID);
+// view.refresh();
+// return null;
+// }
+//
+// public void setUserAdminService(UserAdminService userAdminService) {
+// this.userAdminService = userAdminService;
+// }
+// }
\ No newline at end of file