Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: b96139545e7138014fb950bad4191ae9cb35a102 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package org.eclipse.emf.internal.cdo.bundle;

import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.emf.common.util.ResourceLocator;

import org.osgi.framework.BundleContext;

public final class Activator extends EMFPlugin
{
  // @Singleton
  public static final Activator INSTANCE = new Activator();

  private static Implementation plugin;

  public Activator()
  {
    super(new ResourceLocator[] {});
  }

  @Override
  public ResourceLocator getPluginResourceLocator()
  {
    return plugin;
  }

  public static Implementation getPlugin()
  {
    return plugin;
  }

  public static class Implementation extends EclipsePlugin // implements
  // IRegistryChangeListener
  {
    public Implementation()
    {
      plugin = this;
    }

    @Override
    public void start(BundleContext context) throws Exception
    {
      super.start(context);
      CDO.BUNDLE.setBundleContext(context);
      // EMFUtil.addModelInfos(EMFUtil.PACKAGE_MANAGER);
      // IExtensionRegistry registry = Platform.getExtensionRegistry();
      // IConfigurationElement[] elements =
      // registry.getConfigurationElementsFor(CDO.BUNDLE_ID,
      // CDO.PERSISTENT_PACKAGE_EXT_POINT);
      // for (IConfigurationElement element : elements)
      // {
      // String uri = element.getAttribute("uri");
      // // TODO Don't load EPackages eagerly
      // EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(uri);
      // if (ePackage != null)
      // {
      // EMFUtil.getCDOPackage(ePackage, EMFUtil.PACKAGE_MANAGER);
      // }
      // else
      // {
      // CDO.LOG.warn("Ecore package not found: " + uri);
      // }
      // }
      //
      // registry.addRegistryChangeListener(this, CDO.BUNDLE_ID);
    }

    @Override
    public void stop(BundleContext context) throws Exception
    {
      // IExtensionRegistry registry = Platform.getExtensionRegistry();
      // registry.removeRegistryChangeListener(this);
      // EMFUtil.removeModelInfos(EMFUtil.PACKAGE_MANAGER);
      plugin = null;
      CDO.BUNDLE.setBundleContext(null);
      super.stop(context);
    }

    // public void registryChanged(IRegistryChangeEvent event)
    // {
    // }
  }
}

Back to the top