1 package org.simantics.district.network.ui.internal;
3 import org.osgi.framework.BundleActivator;
4 import org.osgi.framework.BundleContext;
5 import org.osgi.util.tracker.ServiceTracker;
6 import org.simantics.district.network.ui.breakdown.SubgraphProvider;
8 public class Activator implements BundleActivator {
10 public static final String PLUGIN_ID = "org.simantics.district.network.ui";
11 private static Activator instance;
12 private static BundleContext context;
13 private ServiceTracker<SubgraphProvider, SubgraphProvider> subgraphProviderTracker;
16 public void start(BundleContext context) throws Exception {
17 Activator.instance = this;
18 Activator.context = context;
20 subgraphProviderTracker = new ServiceTracker<>(context, SubgraphProvider.class.getName(), null);
21 subgraphProviderTracker.open();
25 public void stop(BundleContext context) throws Exception {
26 subgraphProviderTracker.close();
28 Activator.instance = null;
29 Activator.context = null;
32 public static Activator getInstance() {
36 public static BundleContext getContext() {
40 public SubgraphProvider[] getSubgraphProviders() {
41 return subgraphProviderTracker.getServices(new SubgraphProvider[0]);