Skip to content

Commit

Permalink
Define an OSGi Activator inside ternjs. See
Browse files Browse the repository at this point in the history
  • Loading branch information
angelozerr committed Jan 31, 2015
1 parent df96fea commit fa61fd5
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 9 deletions.
10 changes: 6 additions & 4 deletions core/tern.core/src/tern/Activator.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2013-2014 Angelo ZERR.
* Copyright (c) 2013-present Angelo ZERR.
* 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
Expand All @@ -13,12 +13,14 @@
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

/**
* OSGi Activator for tern.core bundle.
*
*/
public class Activator implements BundleActivator {

public static final String TERNJS_PLUGIN_ID = "ternjs";

public static final String PLUGIN_ID = "tern.core";

private static BundleContext context;

static BundleContext getContext() {
Expand Down
7 changes: 7 additions & 0 deletions core/ternjs/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
2 changes: 2 additions & 0 deletions core/ternjs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/bin
/target
12 changes: 12 additions & 0 deletions core/ternjs/.project
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
Expand All @@ -15,8 +20,15 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
6 changes: 5 additions & 1 deletion core/ternjs/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-SymbolicName: ternjs
Bundle-SymbolicName: ternjs;singleton:=true
Bundle-Version: 0.9.0.qualifier
Eclipse-BundleShape: dir
Import-Package: org.osgi.framework
Export-Package: ternjs
Bundle-Activator: ternjs.Activator
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
6 changes: 4 additions & 2 deletions core/ternjs/build.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
node_modules/tern/,\
plugin.properties,\
metadata/
metadata/,\
node_modules/
51 changes: 51 additions & 0 deletions core/ternjs/src/ternjs/Activator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* Copyright (c) 2013-present Angelo ZERR.
* 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:
* Angelo Zerr <[email protected]> - initial API and implementation
*/
package ternjs;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

/**
* OSGi Activator for ternjs bundle.
*
*/
public class Activator implements BundleActivator {

public static final String PLUGIN_ID = "ternjs";

private static BundleContext context;

static BundleContext getContext() {
return context;
}

/*
* (non-Javadoc)
*
* @see
* org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext
* )
*/
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
}

/*
* (non-Javadoc)
*
* @see
* org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext bundleContext) throws Exception {
Activator.context = null;
}

}
1 change: 1 addition & 0 deletions eclipse/tern.eclipse.ide.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Bundle-Version: 0.9.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
ternjs,
tern.core,
tern.server.nodejs,
tern.eclipse,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ public void start(BundleContext context) throws Exception {

public static File getTernCoreBaseDir() throws IOException {
return FileLocator.getBundleFile(Platform
.getBundle(tern.Activator.TERNJS_PLUGIN_ID));
.getBundle(ternjs.Activator.PLUGIN_ID));
}

public static File getTernBaseDir() throws IOException {
return new File(FileLocator.getBundleFile(Platform
.getBundle(tern.Activator.TERNJS_PLUGIN_ID)), "node_modules/tern");
.getBundle(ternjs.Activator.PLUGIN_ID)), "node_modules/tern");
}

@Override
Expand Down

0 comments on commit fa61fd5

Please sign in to comment.