package org.simantics.district.network.ui.internal;
-import org.osgi.framework.BundleActivator;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import org.osgi.util.tracker.ServiceTracker;
import org.simantics.district.network.ui.breakdown.SubgraphProvider;
+import org.simantics.district.route.RouteService;
-public class Activator implements BundleActivator {
+public class Activator extends AbstractUIPlugin {
public static final String PLUGIN_ID = "org.simantics.district.network.ui";
+
private static Activator instance;
private static BundleContext context;
+
private ServiceTracker<SubgraphProvider, SubgraphProvider> subgraphProviderTracker;
+ private ServiceTracker<RouteService, RouteService> routeServiceTracker;
@Override
public void start(BundleContext context) throws Exception {
subgraphProviderTracker = new ServiceTracker<>(context, SubgraphProvider.class.getName(), null);
subgraphProviderTracker.open();
+ routeServiceTracker = new ServiceTracker<>(context, RouteService.class.getName(), null);
+ routeServiceTracker.open();
}
@Override
public void stop(BundleContext context) throws Exception {
subgraphProviderTracker.close();
+ routeServiceTracker.close();
Activator.instance = null;
Activator.context = null;
return subgraphProviderTracker.getServices(new SubgraphProvider[0]);
}
+ public RouteService getRouteService() {
+ return routeServiceTracker.getService();
+ }
+
}