]> git.argeo.org Git - lgpl/argeo-commons.git/blob - eclipse/plugins/org.argeo.eclipse.ui/src/main/java/org/argeo/eclipse/ui/ArgeoUiPlugin.java
Improve error reporting in eclipse ui
[lgpl/argeo-commons.git] / eclipse / plugins / org.argeo.eclipse.ui / src / main / java / org / argeo / eclipse / ui / ArgeoUiPlugin.java
1 /*
2 * Copyright (C) 2010 Mathieu Baudier <mbaudier@argeo.org>
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package org.argeo.eclipse.ui;
18
19 import org.eclipse.core.runtime.Platform;
20 import org.eclipse.ui.plugin.AbstractUIPlugin;
21 import org.osgi.framework.Bundle;
22 import org.osgi.framework.BundleContext;
23
24 /**
25 * The activator class controls the plug-in life cycle
26 */
27 public class ArgeoUiPlugin extends AbstractUIPlugin {
28
29 // The plug-in ID
30 public static final String PLUGIN_ID = "org.argeo.eclipse.ui";
31
32 private final static String SPRING_OSGI_EXTENDER = "org.springframework.osgi.extender";
33
34 // The shared instance
35 private static ArgeoUiPlugin plugin;
36
37 private BundleContext bundleContext;
38
39 /**
40 * The constructor
41 */
42 public ArgeoUiPlugin() {
43 }
44
45 /*
46 * (non-Javadoc)
47 *
48 * @see
49 * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
50 * )
51 */
52 public void start(BundleContext context) throws Exception {
53 super.start(context);
54 plugin = this;
55 bundleContext = context;
56
57 // Make sure that the Spring OSGi extender is started
58 Bundle osgiExtBundle = Platform.getBundle(SPRING_OSGI_EXTENDER);
59 if (osgiExtBundle != null)
60 osgiExtBundle.start();
61 else
62 throw new Exception("Spring OSGi Extender not found");
63 }
64
65 /*
66 * (non-Javadoc)
67 *
68 * @see
69 * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
70 * )
71 */
72 public void stop(BundleContext context) throws Exception {
73 plugin = null;
74 super.stop(context);
75 }
76
77 /**
78 * Returns the shared instance
79 *
80 * @return the shared instance
81 */
82 public static ArgeoUiPlugin getDefault() {
83 return plugin;
84 }
85
86 public BundleContext getBundleContext() {
87 return bundleContext;
88 }
89
90 }