Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIActivator.java')
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIActivator.java72
1 files changed, 66 insertions, 6 deletions
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIActivator.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIActivator.java
index a4a0d6b52c..d3f167e60d 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIActivator.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIActivator.java
@@ -24,6 +24,11 @@ public class UIActivator extends AbstractUIPlugin
{
private OMBundle omBundle;
+ /**
+ * @since 2.0
+ */
+ protected BundleContext bundleContext;
+
public UIActivator(OMBundle omBundle)
{
this.omBundle = omBundle;
@@ -35,16 +40,71 @@ public class UIActivator extends AbstractUIPlugin
}
@Override
- public void start(BundleContext context) throws Exception
+ public final void start(BundleContext context) throws Exception
{
- OSGiActivator.startBundle(context, getOMBundle());
- super.start(context);
+ bundleContext = context;
+ OSGiActivator.traceStart(context);
+ if (omBundle == null)
+ {
+ throw new IllegalStateException("bundle == null");
+ }
+
+ try
+ {
+ super.start(context);
+ omBundle.setBundleContext(context);
+ doStart();
+ }
+ catch (Error error)
+ {
+ omBundle.logger().error(error);
+ throw error;
+ }
+ catch (Exception ex)
+ {
+ omBundle.logger().error(ex);
+ throw ex;
+ }
}
@Override
- public void stop(BundleContext context) throws Exception
+ public final void stop(BundleContext context) throws Exception
+ {
+ OSGiActivator.traceStop(context);
+ if (omBundle == null)
+ {
+ throw new IllegalStateException("bundle == null");
+ }
+
+ try
+ {
+ doStop();
+ omBundle.setBundleContext(null);
+ super.stop(context);
+ }
+ catch (Error error)
+ {
+ omBundle.logger().error(error);
+ throw error;
+ }
+ catch (Exception ex)
+ {
+ omBundle.logger().error(ex);
+ throw ex;
+ }
+ }
+
+ /**
+ * @since 2.0
+ */
+ protected void doStart() throws Exception
+ {
+ }
+
+ /**
+ * @since 2.0
+ */
+ protected void doStop() throws Exception
{
- super.stop(context);
- OSGiActivator.stopBundle(context, getOMBundle());
}
}

Back to the top