Search in sources :

Example 1 with CodeContext

use of org.erlide.backend.api.ICodeBundle.CodeContext in project erlide_eclipse by erlang.

the class BackendManager method addCodeBundle.

private void addCodeBundle(final IExtension extension) {
    final String pluginId = extension.getContributor().getName();
    final Bundle plugin = Platform.getBundle(pluginId);
    final Multimap<CodeContext, String> paths = HashMultimap.create();
    final List<Pair<String, String>> inits = Lists.newArrayList();
    RuntimeVersion ver = RuntimeVersion.NO_VERSION;
    for (final IConfigurationElement el : extension.getConfigurationElements()) {
        if ("beam_dir".equals(el.getName())) {
            final String dir = el.getAttribute("path");
            final String t = el.getAttribute("context").toUpperCase();
            final CodeContext type = Enum.valueOf(CodeContext.class, t);
            paths.put(type, dir);
        } else if ("init".equals(el.getName())) {
            final String module = el.getAttribute("module");
            final String function = el.getAttribute("function");
            inits.add(new Pair<>(module, function));
        } else if ("otp_version".equals(el.getName())) {
            final String attribute = el.getAttribute("value");
            if (attribute != null) {
                ver = RuntimeVersion.Serializer.parse(attribute);
            }
        } else {
            ErlLogger.error("Unknown code bundle element: %s", el.getName());
        }
    }
    addBundle(plugin, ver, paths, inits);
}
Also used : ICodeBundle(org.erlide.backend.api.ICodeBundle) Bundle(org.osgi.framework.Bundle) CodeContext(org.erlide.backend.api.ICodeBundle.CodeContext) RuntimeVersion(org.erlide.runtime.runtimeinfo.RuntimeVersion) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) Pair(org.eclipse.xtext.xbase.lib.Pair)

Aggregations

IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)1 Pair (org.eclipse.xtext.xbase.lib.Pair)1 ICodeBundle (org.erlide.backend.api.ICodeBundle)1 CodeContext (org.erlide.backend.api.ICodeBundle.CodeContext)1 RuntimeVersion (org.erlide.runtime.runtimeinfo.RuntimeVersion)1 Bundle (org.osgi.framework.Bundle)1