1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.project.internal;
14 import java.util.Hashtable;
16 import org.eclipse.core.runtime.Plugin;
17 import org.osgi.framework.BundleContext;
18 import org.osgi.framework.ServiceRegistration;
19 import org.simantics.project.features.registry.IProjectFeatureRegistry;
22 * @author Tuukka Lehtonen
24 public class Activator extends Plugin {
27 public static final String PLUGIN_ID = "org.simantics.project";
29 // The shared instance
30 private static Activator plugin;
32 private BundleContext bundleContext;
34 private ProjectFeatureRegistry projectFeatureRegistryService = null;
35 @SuppressWarnings("rawtypes")
36 private ServiceRegistration projectFeatureRegistry = null;
46 * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
48 @SuppressWarnings({ "unchecked", "rawtypes" })
50 public void start(BundleContext context) throws Exception {
52 this.bundleContext = context;
55 projectFeatureRegistryService = new ProjectFeatureRegistry();
56 projectFeatureRegistry = bundleContext.registerService(IProjectFeatureRegistry.class.getName(), projectFeatureRegistryService, new Hashtable());
61 * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
64 public void stop(BundleContext context) throws Exception {
65 if (projectFeatureRegistry != null) {
66 projectFeatureRegistry.unregister();
67 projectFeatureRegistry = null;
70 this.bundleContext = null;
76 * Returns the shared instance
78 * @return the shared instance
80 public static Activator getDefault() {
87 public IProjectFeatureRegistry getProjectFeatureRegistry() {
88 return projectFeatureRegistryService;
91 public BundleContext getContext() {