Search in sources :

Example 1 with JavaCode

use of com.centurylink.mdw.plugin.codegen.meta.JavaCode in project mdw-designer by CenturyLinkCloud.

the class JavaSource method getDefaultContent.

@Override
public String getDefaultContent() {
    try {
        // initialize from template
        String templateUri = Platform.getBundle(MdwPlugin.getPluginId()).getEntry("/").toString() + "/templates/source/JavaSource.javajet";
        JETEmitter emitter = new JETEmitter(templateUri, getClass().getClassLoader());
        emitter.addVariable(null, MdwPlugin.getPluginId());
        Map<String, Object> map = new HashMap<String, Object>();
        JavaCode javaCode = new JavaCode(getJavaPackageName(), getJavaClassName());
        map.put("model", javaCode);
        map.put("settings", MdwPlugin.getSettings());
        return emitter.generate(new NullProgressMonitor(), new Object[] { map });
    } catch (JETException ex) {
        PluginMessages.uiError(ex, "Generate Java", getProject());
        return null;
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) HashMap(java.util.HashMap) JavaCode(com.centurylink.mdw.plugin.codegen.meta.JavaCode) JETEmitter(org.eclipse.emf.codegen.jet.JETEmitter) JETException(org.eclipse.emf.codegen.jet.JETException)

Aggregations

JavaCode (com.centurylink.mdw.plugin.codegen.meta.JavaCode)1 HashMap (java.util.HashMap)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 JETEmitter (org.eclipse.emf.codegen.jet.JETEmitter)1 JETException (org.eclipse.emf.codegen.jet.JETException)1