X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.security.ui.admin%2Fsrc%2Forg%2Fargeo%2Fsecurity%2Fui%2Fadmin%2Fcommands%2FDeleteRole.java;h=a8db0eb8e205077f35366664e3d3a36a92c695cf;hb=f090d55a56532e0e6c2cde5760a451e56ef25f1c;hp=7648e26180caa216b6c26499a3583a3e935fe5a4;hpb=50911fdcc6df5cd35e71a0a4ecddf03f98f742a2;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.security.ui.admin/src/org/argeo/security/ui/admin/commands/DeleteRole.java b/org.argeo.security.ui.admin/src/org/argeo/security/ui/admin/commands/DeleteRole.java index 7648e2618..a8db0eb8e 100644 --- a/org.argeo.security.ui.admin/src/org/argeo/security/ui/admin/commands/DeleteRole.java +++ b/org.argeo.security.ui.admin/src/org/argeo/security/ui/admin/commands/DeleteRole.java @@ -15,19 +15,10 @@ */ 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 toDelete = new ArrayList(); - Iterator 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 toDelete = new ArrayList(); +// Iterator 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