import org.eclipse.swt.widgets.Display;
import org.osgi.service.useradmin.User;
import org.osgi.service.useradmin.UserAdmin;
import org.eclipse.swt.widgets.Display;
import org.osgi.service.useradmin.User;
import org.osgi.service.useradmin.UserAdmin;
- public Object execute() {
- ISelection selection = null;// HandlerUtil.getCurrentSelection(event);
- if (selection.isEmpty())
- return null;
+ public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart part, ESelectionService selectionService) {
+ // ISelection selection = null;// HandlerUtil.getCurrentSelection(event);
+ // if (selection.isEmpty())
+ // return null;
+ List<User> selection = (List<User>) selectionService.getSelection();
+ if (selection == null)
+ return;
- Iterator<User> it = ((IStructuredSelection) selection).iterator();
- List<User> users = new ArrayList<User>();
+// Iterator<User> it = ((IStructuredSelection) selection).iterator();
+// List<User> users = new ArrayList<User>();
String userName = UserAdminUtils.getUserLocalId(currUser.getName());
if (UserAdminUtils.isCurrentUser(currUser)) {
MessageDialog.openError(Display.getCurrent().getActiveShell(), "Deletion forbidden",
"You cannot delete your own user this way.");
String userName = UserAdminUtils.getUserLocalId(currUser.getName());
if (UserAdminUtils.isCurrentUser(currUser)) {
MessageDialog.openError(Display.getCurrent().getActiveShell(), "Deletion forbidden",
"You cannot delete your own user this way.");
}
if (!MessageDialog.openQuestion(Display.getCurrent().getActiveShell(), "Delete Users",
"Are you sure that you want to delete these users?\n" + builder.substring(0, builder.length() - 2)))
}
if (!MessageDialog.openQuestion(Display.getCurrent().getActiveShell(), "Delete Users",
"Are you sure that you want to delete these users?\n" + builder.substring(0, builder.length() - 2)))
userAdminWrapper.beginTransactionIfNeeded();
UserAdmin userAdmin = userAdminWrapper.getUserAdmin();
// IWorkbenchPage iwp =
// HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
userAdminWrapper.beginTransactionIfNeeded();
UserAdmin userAdmin = userAdminWrapper.getUserAdmin();
// IWorkbenchPage iwp =
// HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
String userName = user.getName();
// TODO find a way to close the editor cleanly if opened. Cannot be
// done through the UserAdminListeners, it causes a
String userName = user.getName();
// TODO find a way to close the editor cleanly if opened. Cannot be
// done through the UserAdminListeners, it causes a
- /* DEPENDENCY INJECTION */
- public void setUserAdminWrapper(UserAdminWrapper userAdminWrapper) {
- this.userAdminWrapper = userAdminWrapper;
+ @CanExecute
+ public boolean canExecute(@Named(IServiceConstants.ACTIVE_PART) MPart part, ESelectionService selectionService) {
+ return part.getObject() instanceof UsersView && selectionService.getSelection() != null;