1 package org
.argeo
.security
.ui
;
3 import java
.io
.IOException
;
5 import javax
.security
.auth
.callback
.Callback
;
6 import javax
.security
.auth
.callback
.CallbackHandler
;
7 import javax
.security
.auth
.callback
.UnsupportedCallbackException
;
9 import org
.argeo
.security
.ui
.dialogs
.DefaultLoginDialog
;
10 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
11 import org
.eclipse
.ui
.plugin
.AbstractUIPlugin
;
12 import org
.osgi
.framework
.BundleContext
;
13 import org
.osgi
.framework
.ServiceRegistration
;
16 * The activator class controls the plug-in life cycle
18 public class SecurityUiPlugin
extends AbstractUIPlugin
{
21 public static final String PLUGIN_ID
= "org.argeo.security.ui"; //$NON-NLS-1$
23 public final static String CONTEXT_KEYRING
= "KEYRING";
25 private CallbackHandler defaultCallbackHandler
;
26 private ServiceRegistration defaultCallbackHandlerReg
;
28 private static SecurityUiPlugin plugin
;
30 public void start(BundleContext context
) throws Exception
{
34 defaultCallbackHandler
= new CallbackHandler() {
35 public void handle(Callback
[] callbacks
) throws IOException
,
36 UnsupportedCallbackException
{
37 DefaultLoginDialog dialog
= new DefaultLoginDialog();
38 dialog
.handle(callbacks
);
41 defaultCallbackHandlerReg
= context
.registerService(
42 CallbackHandler
.class.getName(), defaultCallbackHandler
, null);
45 public void stop(BundleContext context
) throws Exception
{
47 defaultCallbackHandlerReg
.unregister();
52 * Returns the shared instance
54 * @return the shared instance
56 public static SecurityUiPlugin
getDefault() {
60 public static ImageDescriptor
getImageDescriptor(String path
) {
61 return imageDescriptorFromPlugin(PLUGIN_ID
, path
);