diff --git a/plugins/org.etsi.mts.tdl.tx.ui/src/org/etsi/mts/tdl/ui/wizard/TDLtxProjectWithOpenAPI.xtend b/plugins/org.etsi.mts.tdl.tx.ui/src/org/etsi/mts/tdl/ui/wizard/TDLtxProjectWithOpenAPI.xtend index 2bc04505f17a6e628ac45cd8a0c1b5ef59f3a684..9059ebdc5c180e3a1bf27738a7c6374868f4e7fb 100644 --- a/plugins/org.etsi.mts.tdl.tx.ui/src/org/etsi/mts/tdl/ui/wizard/TDLtxProjectWithOpenAPI.xtend +++ b/plugins/org.etsi.mts.tdl.tx.ui/src/org/etsi/mts/tdl/ui/wizard/TDLtxProjectWithOpenAPI.xtend @@ -34,18 +34,19 @@ final class TDLtxProjectWithOpenAPI { val lastUsed = "LAST_USED" //TODO: file prompt? //TODO: remove after testing - val advanced = check("Advanced:", false) + val advanced = check("Advanced:", true) val advancedGroup = group("Properties") // val name = combo("Package Name:", #["Example", "Sample", "Tutorial", "Pack"], "The name of the package", advancedGroup) val name = text("Main Package Name:", "Main", "The name of the main package") //TODO: add other options val importStandard = check("Import TDL Library", true, "Import TDL standard library definitions.", advancedGroup) - val importHTTP = check("Import HTTP Library", false, "Import TDL HTTP library definitions.", advancedGroup) + val importHTTP = check("Import HTTP Library", true, "Import TDL HTTP library definitions.", advancedGroup) + val importJava = check("Import Java mapping libraries", false, "Import TDL Java mappings.", advancedGroup) val extendedNature = check("Add additional natures", false, "Add Eclipse Plug-in and Java natures", advancedGroup) val path = text("Path:", "tdl", "The package path to place the files in", advancedGroup) - val dataDefinitionsPath = text("Data DefinitionsPath:", s.getString(lastUsed), "The data definitions path to import from", advancedGroup) - val sourceMapping = text("Source mapping tag:", "SOURCE_MAPPING", "The source mapping tag to be used for the data mappings", advancedGroup) - val targetMapping = text("Target mapping tag:", "TARGET_MAPPING", "The target mapping tag to be used for the data mappings", advancedGroup) +// val dataDefinitionsPath = text("Data DefinitionsPath:", s.getString(lastUsed), "The data definitions path to import from", advancedGroup) +// val sourceMapping = text("Source mapping tag:", "SOURCE_MAPPING", "The source mapping tag to be used for the data mappings", advancedGroup) +// val targetMapping = text("Target mapping tag:", "TARGET_MAPPING", "The target mapping tag to be used for the data mappings", advancedGroup) @Inject PluginImageHelper pluginImageHelper @@ -57,20 +58,21 @@ final class TDLtxProjectWithOpenAPI { importHTTP.enabled = advanced.value extendedNature.enabled = advanced.value - dataDefinitionsPath.enabled = advanced.value - sourceMapping.enabled = advanced.value - targetMapping.enabled = advanced.value +// dataDefinitionsPath.enabled = advanced.value +// sourceMapping.enabled = advanced.value +// targetMapping.enabled = advanced.value if (!advanced.value) { name.value = "Main" path.value = "tdl" importStandard.value = true - importHTTP.value = false + importHTTP.value = true + importJava.value = false extendedNature.value = false - dataDefinitionsPath.value = s.getString(lastUsed) - sourceMapping.value = "SOURCE_MAPPING" - targetMapping.value = "TARGET_MAPPING" +// dataDefinitionsPath.value = s.getString(lastUsed) +// sourceMapping.value = "SOURCE_MAPPING" +// targetMapping.value = "TARGET_MAPPING" } } @@ -88,6 +90,7 @@ final class TDLtxProjectWithOpenAPI { projectName = projectInfo.projectName location = projectInfo.locationPath projectNatures += #[XtextProjectHelper.NATURE_ID] + projectNatures += #["org.etsi.mts.tdl.nature"] builderIds += #[XtextProjectHelper.BUILDER_ID] if (extendedNature.value) { projectNatures += #[JavaCore.NATURE_ID, "org.eclipse.pde.PluginNature"] @@ -107,22 +110,29 @@ final class TDLtxProjectWithOpenAPI { imports += "Import all from HTTP\n" imports += "Import all from HTTP.MessageBased\n" } + if (importJava.value) { + addFile('''src/«path»/Java.tdltx''', TemplateHelper.getLibrary("Java")) + addFile('''src/«path»/TdlRuntime.tdltx''', TemplateHelper.getLibrary("TdlRuntime")) + if (importHTTP.value) { + addFile('''src/«path»/HttpJavaMappings.tdltx''', TemplateHelper.getLibrary("HttpJavaMappings")) + imports += "Import all from HttpJavaMappings\n" + } + imports += "Import all from Java\n" + } //TODO: make target package name configurable? i.e. based on name - addFile('''src/«path»/imported.tdltx''', - ConverterNext.processToString(dataDefinitionsPath.value, - "src/"+path.value+"/Imported.tdltx", - sourceMapping.value, - targetMapping.value - )) - val importsName = "generated_from_"+ConverterNext.getTargetPackageName(dataDefinitionsPath.value) +// addFile('''src/«path»/imported.tdltx''', +// ConverterNext.processToString(dataDefinitionsPath.value, +// "src/"+path.value+"/Imported.tdltx", +// sourceMapping.value, +// targetMapping.value +// )) + // val importsName = "generated_from_"+ConverterNext.getTargetPackageName(dataDefinitionsPath.value) addFile('''src/«path»/«name».tdltx''', ''' /* * This is an example package */ Package «name» { - Import all from TDL - Import all from «importsName» - Type simple + «imports» } ''')