Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.tcf.core/activator/org/eclipse/tcf/internal/Activator.java')
-rw-r--r--plugins/org.eclipse.tcf.core/activator/org/eclipse/tcf/internal/Activator.java46
1 files changed, 46 insertions, 0 deletions
diff --git a/plugins/org.eclipse.tcf.core/activator/org/eclipse/tcf/internal/Activator.java b/plugins/org.eclipse.tcf.core/activator/org/eclipse/tcf/internal/Activator.java
new file mode 100644
index 000000000..283d1c99c
--- /dev/null
+++ b/plugins/org.eclipse.tcf.core/activator/org/eclipse/tcf/internal/Activator.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.internal.tcf;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.packageadmin.PackageAdmin;
+import org.osgi.util.tracker.ServiceTracker;
+
+public class Activator implements BundleActivator {
+
+ private static final String TCF_INTEGRATION_BUNDLE_ID = "org.eclipse.tm.tcf";
+
+ public void start(BundleContext context) throws Exception {
+ /*
+ * Activate TCF Eclipse integration bundle "org.eclipse.tm.tcf".
+ * It must be activated explicitly, because default activation through
+ * class loading may never happen - most client don't need classes from that bundle.
+ */
+ ServiceTracker tracker = new ServiceTracker(context, PackageAdmin.class.getName(), null);
+ tracker.open();
+ Bundle[] bundles = ((PackageAdmin)tracker.getService()).getBundles(TCF_INTEGRATION_BUNDLE_ID, null);
+ int cnt = 0;
+ if (bundles != null) {
+ for (Bundle bundle : bundles) {
+ if ((bundle.getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) {
+ bundle.start(Bundle.START_TRANSIENT);
+ cnt++;
+ }
+ }
+ }
+ if (cnt != 1) throw new Exception("Invalid or missing bundle: " + TCF_INTEGRATION_BUNDLE_ID);
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ }
+}

Back to the top