Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2013-04-03 08:54:37 +0000
committerHenrik Rentz-Reichert2013-04-03 08:54:37 +0000
commit2c008b4e35ad4f5a94fb9a0af992531bac210578 (patch)
tree34a9ac0cd831b395e3a899ab24b629e2d240f366 /plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend
parentcefa8fbcabdf55cd0098bbee39ac17e02f78ffb5 (diff)
downloadorg.eclipse.etrice-2c008b4e35ad4f5a94fb9a0af992531bac210578.tar.gz
org.eclipse.etrice-2c008b4e35ad4f5a94fb9a0af992531bac210578.tar.xz
org.eclipse.etrice-2c008b4e35ad4f5a94fb9a0af992531bac210578.zip
[core.genmodel, generator, generator.c, generator.java] bug 403721: incremental codegeneration
https://bugs.eclipse.org/bugs/show_bug.cgi?id=403721 - introduced interface IGeneratorFileIo for code generation - added standard implementation IncrementalFileIo - using default non-incremental
Diffstat (limited to 'plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend')
-rw-r--r--plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend42
1 files changed, 21 insertions, 21 deletions
diff --git a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend
index a20cb366f..a81641de4 100644
--- a/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.java/src/org/eclipse/etrice/generator/java/gen/ProtocolClassGen.xtend
@@ -14,28 +14,25 @@ package org.eclipse.etrice.generator.java.gen
import com.google.inject.Inject
import com.google.inject.Singleton
-import org.eclipse.etrice.core.room.Message
-import org.eclipse.etrice.core.room.ProtocolClass
-import org.eclipse.etrice.core.room.PrimitiveType
-import org.eclipse.etrice.core.room.DataClass
-
import org.eclipse.etrice.core.genmodel.base.ILogger
import org.eclipse.etrice.core.genmodel.etricegen.Root
-
-import org.eclipse.xtext.generator.JavaIoFileSystemAccess
-
-import org.eclipse.etrice.generator.generic.RoomExtensions
+import org.eclipse.etrice.core.room.CommunicationType
+import org.eclipse.etrice.core.room.DataClass
+import org.eclipse.etrice.core.room.Message
+import org.eclipse.etrice.core.room.PrimitiveType
+import org.eclipse.etrice.core.room.ProtocolClass
+import org.eclipse.etrice.generator.base.IGeneratorFileIo
+import org.eclipse.etrice.generator.generic.GenericProtocolClassGenerator
import org.eclipse.etrice.generator.generic.ProcedureHelpers
+import org.eclipse.etrice.generator.generic.RoomExtensions
import org.eclipse.etrice.generator.generic.TypeHelpers
-import org.eclipse.etrice.generator.generic.GenericProtocolClassGenerator
-import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
-import org.eclipse.etrice.core.room.CommunicationType
+import static extension org.eclipse.etrice.core.room.util.RoomHelpers.*
@Singleton
class ProtocolClassGen extends GenericProtocolClassGenerator {
- @Inject JavaIoFileSystemAccess fileAccess
+ @Inject IGeneratorFileIo fileIO
@Inject extension JavaExtensions
@Inject extension RoomExtensions
@Inject extension ProcedureHelpers
@@ -46,19 +43,22 @@ class ProtocolClassGen extends GenericProtocolClassGenerator {
def doGenerate(Root root) {
for (pc: root.usedProtocolClasses) {
- var path = pc.generationTargetPath+pc.getPath
- var file = pc.getJavaFileName
- logger.logInfo("generating ProtocolClass implementation '"+file+"' in '"+path+"'")
- fileAccess.setOutputPath(path)
-
+ val path = pc.generationTargetPath+pc.getPath
+ val infopath = pc.generationInfoPath+pc.getPath
+ val file = pc.getJavaFileName
+ val contents =
switch (pc.commType) {
case CommunicationType::EVENT_DRIVEN:
- fileAccess.generateFile(file, root.generate(pc))
+ root.generate(pc)
case CommunicationType::DATA_DRIVEN:
- fileAccess.generateFile(file, root.generateDataDriven(pc))
+ root.generateDataDriven(pc)
case CommunicationType::SYNCHRONOUS:
- logger.logError("synchronous protocols not supported yet", pc)
+ ""
}
+ if (contents.toString.empty)
+ logger.logError("synchronous protocols not supported yet", pc)
+ else
+ fileIO.generateFile("generating ProtocolClass implementation", path, infopath, file, contents)
}
}

Back to the top