package org.omnetpp.ned.editor.wizards;

import org.eclipse.core.runtime.CoreException;
import org.omnetpp.common.wizard.CreationContext;
import org.omnetpp.common.wizard.IContentTemplateContributor;
import org.omnetpp.ned.core.NedResourcesPlugin;
import org.omnetpp.ned.editor.wizards.support.NedUtils;

import freemarker.ext.beans.BeansWrapper;
import freemarker.template.TemplateException;

/**
 * Contributes NED-related functionality to IContentTemplate-based wizards
 *
 * @author Andras
 */
public class NedContentTemplateContributor implements IContentTemplateContributor {

    public NedContentTemplateContributor() {
    }

    public void contributeToContext(CreationContext context) throws CoreException, TemplateException {
        context.setVariable("nedResources", NedResourcesPlugin.getNedResources());
        context.setVariable("msgResources", NedResourcesPlugin.getMsgResources());
        context.setVariable("NedUtils", BeansWrapper.getDefaultInstance().getStaticModels().get(NedUtils.class.getName()));
    }

    public String getAdditionalTemplateCode() throws CoreException, TemplateException {
        return null;
    }

    public void postPerformFinish() throws CoreException, TemplateException {
    }

}
