Search in sources :

Example 1 with ReflectAction

use of aQute.bnd.build.ReflectAction in project bndtools by bndtools.

the class Activator method start.

/*
     * (non-Javadoc)
     * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext )
     */
@Override
public void start(BundleContext context) throws Exception {
    super.start(context);
    instance = this;
    this.context = context;
    Hashtable<String, Object> p = new Hashtable<String, Object>();
    // p.put(Action.ACTION_MENU, new String[] {"a:b", "a:c", "a:d",
    // "a:d:e"});
    context.registerService(Action.class.getName(), new ReflectAction(""), p);
    // We want the repoindex bundle to start so it registers its service.
    // (sigh... Eclipse)
    Bundle repoindex = BundleUtils.findBundle(context, "org.osgi.impl.bundle.repoindex.lib", new VersionRange("0"));
    if (repoindex != null) {
        try {
            repoindex.start();
        } catch (BundleException e) {
            getLog().log(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Failed to start repository indexer plugin.", e));
        }
    } else {
        getLog().log(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Repository indexer plugin is not available.", null));
    }
    Hashtable<String, Object> dataUrlHandlerProps = new Hashtable<>();
    dataUrlHandlerProps.put(URLConstants.URL_HANDLER_PROTOCOL, DataURLStreamHandler.PROTOCOL);
    dataUrlHandlerReg = context.registerService(URLStreamHandlerService.class, new DataURLStreamHandler(), dataUrlHandlerProps);
}
Also used : Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) Action(aQute.bnd.service.action.Action) ReflectAction(aQute.bnd.build.ReflectAction) URLStreamHandlerService(org.osgi.service.url.URLStreamHandlerService) Hashtable(java.util.Hashtable) Bundle(org.osgi.framework.Bundle) ReflectAction(aQute.bnd.build.ReflectAction) VersionRange(aQute.bnd.version.VersionRange) BundleException(org.osgi.framework.BundleException)

Aggregations

ReflectAction (aQute.bnd.build.ReflectAction)1 Action (aQute.bnd.service.action.Action)1 VersionRange (aQute.bnd.version.VersionRange)1 Hashtable (java.util.Hashtable)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 Bundle (org.osgi.framework.Bundle)1 BundleException (org.osgi.framework.BundleException)1 URLStreamHandlerService (org.osgi.service.url.URLStreamHandlerService)1