1 package org
.argeo
.security
.ui
;
3 import org
.argeo
.ArgeoException
;
4 import org
.argeo
.security
.ArgeoUser
;
5 import org
.argeo
.security
.UserNature
;
6 import org
.argeo
.security
.nature
.SimpleUserNature
;
7 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
8 import org
.eclipse
.ui
.plugin
.AbstractUIPlugin
;
9 import org
.osgi
.framework
.BundleContext
;
12 * The activator class controls the plug-in life cycle
14 public class SecurityUiPlugin
extends AbstractUIPlugin
{
17 public static final String PLUGIN_ID
= "org.argeo.security.ui"; //$NON-NLS-1$
19 // The shared instance
20 private static SecurityUiPlugin plugin
;
25 public SecurityUiPlugin() {
32 * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
35 public void start(BundleContext context
) throws Exception
{
44 * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
47 public void stop(BundleContext context
) throws Exception
{
53 * Returns the shared instance
55 * @return the shared instance
57 public static SecurityUiPlugin
getDefault() {
61 public static ImageDescriptor
getImageDescriptor(String path
) {
62 return imageDescriptorFromPlugin(PLUGIN_ID
, path
);
68 public final static SimpleUserNature
findSimpleUserNature(ArgeoUser user
,
69 String simpleNatureType
) {
70 SimpleUserNature simpleNature
= null;
71 if (simpleNatureType
!= null)
72 simpleNature
= (SimpleUserNature
) user
.getUserNatures().get(
75 for (UserNature userNature
: user
.getUserNatures().values())
76 if (userNature
instanceof SimpleUserNature
)
77 simpleNature
= (SimpleUserNature
) userNature
;
79 if (simpleNature
== null)
80 throw new ArgeoException("No simple user nature in user " + user
);