]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - org.argeo.security.ui.admin/src/org/argeo/security/ui/admin/internal/providers/UserTableDefaultDClickListener.java
Improve and simplify OSGi Boot
[lgpl/argeo-commons.git] / org.argeo.security.ui.admin / src / org / argeo / security / ui / admin / internal / providers / UserTableDefaultDClickListener.java
index 94434bd8a3a6942c2a64abc39807cbe00b056732..8f4a35a18059ba3d227da3090d1f5de261a7bc74 100644 (file)
@@ -1,6 +1,6 @@
 package org.argeo.security.ui.admin.internal.providers;
 
-import org.argeo.ArgeoException;
+import org.argeo.cms.CmsException;
 import org.argeo.eclipse.ui.workbench.WorkbenchUiPlugin;
 import org.argeo.security.ui.admin.internal.parts.UserEditor;
 import org.argeo.security.ui.admin.internal.parts.UserEditorInput;
@@ -10,6 +10,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PartInitException;
+import org.osgi.service.useradmin.Group;
 import org.osgi.service.useradmin.User;
 
 /**
@@ -23,17 +24,20 @@ public class UserTableDefaultDClickListener implements IDoubleClickListener {
                Object obj = ((IStructuredSelection) evt.getSelection())
                                .getFirstElement();
                User user = (User) obj;
-               // IWorkbench iw =
                IWorkbenchWindow iww = WorkbenchUiPlugin.getDefault().getWorkbench()
                                .getActiveWorkbenchWindow();
                IWorkbenchPage iwp = iww.getActivePage();
                UserEditorInput uei = new UserEditorInput(user.getName());
 
                try {
-                       // IEditorPart editor =
-                       iwp.openEditor(uei, UserEditor.ID);
+                       // Works around the fact that dynamic setting of the editor icon
+                       // causes NPE after a login/logout on RAP
+                       if (user instanceof Group)
+                               iwp.openEditor(uei, UserEditor.GROUP_EDITOR_ID);
+                       else
+                               iwp.openEditor(uei, UserEditor.USER_EDITOR_ID);
                } catch (PartInitException pie) {
-                       throw new ArgeoException("Unable to open UserEditor for " + user,
+                       throw new CmsException("Unable to open UserEditor for " + user,
                                        pie);
                }
        }