Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diagram?(xtext behavior activity diagram)
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1039715 is a reply to message #1039711] Fri, 12 April 2013 13:47 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Thank you for your information. I will try this weekend. But now, my project vannot work, because the error mentioned. Wishing you a nice weekend!
Christian Dietrich wrote on Fri, 12 April 2013 09:43
Hi

XExpression has not only the subclasses XFeatureCall and XBlockExpression but XIfExpression too

[Updated on: Fri, 12 April 2013 13:50]

Report message to a moderator

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1039720 is a reply to message #1039712] Fri, 12 April 2013 13:53 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
I would like to try the "if" in the activity diagram. But currently, my project cannot work, because of the error info mentioned. I did not do anything, I think, I just changed the "internalDoGenerate" code to the following:

def dispatch internalDoGenerate(DomainModel m, IFileSystemAccess fsa
) {
for (e : m.eAllContents.toIterable.filter(typeof(Entity))) {

fsa.generateFile(e.fullyQualifiedName.toString+".txt",'''
«FOR op : e.features.filter(typeof(Operation))»
«op.name»:
«op.body.print»
«ENDFOR»
''')

}
}
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1039721 is a reply to message #1039720] Fri, 12 April 2013 13:54 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
def dispatch CharSequence print(XFeatureCall e)

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1039726 is a reply to message #1039721] Fri, 12 April 2013 14:04 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Now it works, but if I change the code into the following code:

def dispatch internalDoGenerate(DomainModel m, IFileSystemAccess fsa
) {
for (e : m.eAllContents.toIterable.filter(typeof(Entity))) {

// output for image in editor
fsa.generateFile(e.fullyQualifiedName.toString+".txt",'''
«FOR op : e.features.filter(typeof(Operation))»
«op.name»:
«op.body.print»
«ENDFOR»
''')
}

for (e : m.eAllContents.toIterable.filter(typeof(Entity))) {
for (op : e.features.filter(typeof(Operation))) {
val content = '''
«op.body.print»
'''.toString

if (fsa instanceof IFileSystemAccessExtension3) {
val out = new ByteArrayOutputStream()
new SourceStringReader(content).generateImage(out)
(fsa as IFileSystemAccessExtension3).generateFile(op.fullyQualifiedName.toString+".png",new ByteArrayInputStream(out.toByteArray))
} else {
fsa.generateFile(op.fullyQualifiedName.toString+".txt",content)
}
}
}

}

the error information appears, and the code cannot be automatically generated. What would be the mistake? Thank you!

!SESSION 2013-04-12 16:01:03.374 -----------------------------------------------
eclipse.buildId=M20130204-1200
java.version=1.7.0_17
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments: -product org.eclipse.sdk.ide
Command-line arguments: -product org.eclipse.sdk.ide -data D:\TodayNewEight/../runtime-TodayNewEight -dev file:D:/TodayNewEight/.metadata/.plugins/org.eclipse.pde.core/New_configuration/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog

!ENTRY org.eclipse.update.configurator 4 0 2013-04-12 16:01:04.824
!MESSAGE Unable to find feature.xml in directory: C:\eclipsexText64\features\org.eclipse.equinox.p2.discovery.feature_1.0.100.v20120524-0542-4-Bh9oB58A5N9L28PCQ

!ENTRY org.eclipse.egit.ui 2 0 2013-04-12 16:01:23.111
!MESSAGE Warning: EGit couldn't detect the installation path "gitPrefix" of native Git. Hence EGit can't respect system level
Git settings which might be configured in ${gitPrefix}/etc/gitconfig under the native Git installation directory.
The most important of these settings is core.autocrlf. Git for Windows by default sets this parameter to true in
this system level configuration. The Git installation location can be configured on the
Team > Git > Configuration preference page's 'System Settings' tab.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
@startuml
(*)
--> (*)
^^^^^^^
Syntax Error?
@startuml
(*)
--> (*)
^^^^^^^
Syntax Error?

!ENTRY org.eclipse.egit.ui 2 0 2013-04-12 16:01:23.173
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
user global configuration and to define the default location to store repositories: 'H:\'. If this is
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
EGit might behave differently since they see different configuration options.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
@startuml
(*)
--> (*)
^^^^^^^
Syntax Error?
0 [Worker-3] ERROR org.eclipse.xtext.builder.BuilderParticipant - Error during compilation of 'platform:/resource/sad/src/NewTryFile.dmodel'.
java.lang.IllegalArgumentException: Already known: //TODO\n
at net.sourceforge.plantuml.cucadiagram.CucaDiagram.createLeaf(Unknown Source)
at net.sourceforge.plantuml.activitydiagram.ActivityDiagram.createLeaf(Unknown Source)
at net.sourceforge.plantuml.activitydiagram.command.CommandLinkLongActivity2.executeNow(Unknown Source)
at net.sourceforge.plantuml.command.CommandMultilines2.execute(Unknown Source)
at net.sourceforge.plantuml.PSystemSingleBuilder.manageMultiline(Unknown Source)
at net.sourceforge.plantuml.PSystemSingleBuilder.executeUmlCommand(Unknown Source)
at net.sourceforge.plantuml.PSystemSingleBuilder.<init>(Unknown Source)
at net.sourceforge.plantuml.PSystemBuilder.createPSystem(Unknown Source)
at net.sourceforge.plantuml.BlockUml.createSystem(Unknown Source)
at net.sourceforge.plantuml.BlockUml.getSystem(Unknown Source)
at net.sourceforge.plantuml.SourceStringReader.generateImage(Unknown Source)
at net.sourceforge.plantuml.SourceStringReader.generateImage(Unknown Source)
at net.sourceforge.plantuml.SourceStringReader.generateImage(Unknown Source)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen._internalDoGenerate(MySuperGen.java:104)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen.internalDoGenerate(MySuperGen.java:197)
at org.eclipse.xtext.xbase.compiler.JvmModelGenerator.doGenerate(JvmModelGenerator.java:181)
at org.eclipse.xtext.builder.BuilderParticipant.handleChangedContents(BuilderParticipant.java:291)
at org.eclipse.xtext.builder.BuilderParticipant.build(BuilderParticipant.java:221)
at org.eclipse.xtext.builder.impl.RegistryBuilderParticipant.build(RegistryBuilderParticipant.java:60)
at org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBuilder.java:170)
at org.eclipse.xtext.builder.impl.XtextBuilder.fullBuild(XtextBuilder.java:194)
at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuilder.java:89)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:726)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:321)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:396)
at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
at org.eclipse.core.internal.resources.Project.build(Project.java:124)
at org.eclipse.xtext.builder.impl.BuildScheduler$BuildJob.run(BuildScheduler.java:178)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

!ENTRY org.apache.log4j 4 0 2013-04-12 16:01:23.361
!MESSAGE org.eclipse.xtext.builder.BuilderParticipant - Error during compilation of 'platform:/resource/sad/src/NewTryFile.dmodel'.

!STACK 0
java.lang.IllegalArgumentException: Already known: //TODO\n
at net.sourceforge.plantuml.cucadiagram.CucaDiagram.createLeaf(Unknown Source)
at net.sourceforge.plantuml.activitydiagram.ActivityDiagram.createLeaf(Unknown Source)
at net.sourceforge.plantuml.activitydiagram.command.CommandLinkLongActivity2.executeNow(Unknown Source)
at net.sourceforge.plantuml.command.CommandMultilines2.execute(Unknown Source)
at net.sourceforge.plantuml.PSystemSingleBuilder.manageMultiline(Unknown Source)
at net.sourceforge.plantuml.PSystemSingleBuilder.executeUmlCommand(Unknown Source)
at net.sourceforge.plantuml.PSystemSingleBuilder.<init>(Unknown Source)
at net.sourceforge.plantuml.PSystemBuilder.createPSystem(Unknown Source)
at net.sourceforge.plantuml.BlockUml.createSystem(Unknown Source)
at net.sourceforge.plantuml.BlockUml.getSystem(Unknown Source)
at net.sourceforge.plantuml.SourceStringReader.generateImage(Unknown Source)
at net.sourceforge.plantuml.SourceStringReader.generateImage(Unknown Source)
at net.sourceforge.plantuml.SourceStringReader.generateImage(Unknown Source)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen._internalDoGenerate(MySuperGen.java:104)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen.internalDoGenerate(MySuperGen.java:197)
at org.eclipse.xtext.xbase.compiler.JvmModelGenerator.doGenerate(JvmModelGenerator.java:181)
at org.eclipse.xtext.builder.BuilderParticipant.handleChangedContents(BuilderParticipant.java:291)
at org.eclipse.xtext.builder.BuilderParticipant.build(BuilderParticipant.java:221)
at org.eclipse.xtext.builder.impl.RegistryBuilderParticipant.build(RegistryBuilderParticipant.java:60)
at org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBuilder.java:170)
at org.eclipse.xtext.builder.impl.XtextBuilder.fullBuild(XtextBuilder.java:194)
at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuilder.java:89)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:726)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:321)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:396)
at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
at org.eclipse.core.internal.resources.Project.build(Project.java:124)
at org.eclipse.xtext.builder.impl.BuildScheduler$BuildJob.run(BuildScheduler.java:178)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
@startuml
(*)
--> (*)
^^^^^^^
Syntax Error?
@startuml
(*)
--> (*)
^^^^^^^
Syntax Error?
@startuml
(*)
--> (*)
^^^^^^^
Syntax Error?
8113 [Worker-7] ERROR org.eclipse.xtext.builder.BuilderParticipant - Error during compilation of 'platform:/resource/sad/src/NewTryFile.dmodel'.
java.lang.IllegalArgumentException: Already known: //TODO\n
at net.sourceforge.plantuml.cucadiagram.CucaDiagram.createLeaf(Unknown Source)
at net.sourceforge.plantuml.activitydiagram.ActivityDiagram.createLeaf(Unknown Source)
at net.sourceforge.plantuml.activitydiagram.command.CommandLinkLongActivity2.executeNow(Unknown Source)
at net.sourceforge.plantuml.command.CommandMultilines2.execute(Unknown Source)
at net.sourceforge.plantuml.PSystemSingleBuilder.manageMultiline(Unknown Source)
at net.sourceforge.plantuml.PSystemSingleBuilder.executeUmlCommand(Unknown Source)
at net.sourceforge.plantuml.PSystemSingleBuilder.<init>(Unknown Source)
at net.sourceforge.plantuml.PSystemBuilder.createPSystem(Unknown Source)
at net.sourceforge.plantuml.BlockUml.createSystem(Unknown Source)
at net.sourceforge.plantuml.BlockUml.getSystem(Unknown Source)
at net.sourceforge.plantuml.SourceStringReader.generateImage(Unknown Source)
at net.sourceforge.plantuml.SourceStringReader.generateImage(Unknown Source)
at net.sourceforge.plantuml.SourceStringReader.generateImage(Unknown Source)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen._internalDoGenerate(MySuperGen.java:104)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen.internalDoGenerate(MySuperGen.java:197)
at org.eclipse.xtext.xbase.compiler.JvmModelGenerator.doGenerate(JvmModelGenerator.java:181)
at org.eclipse.xtext.builder.BuilderParticipant.handleChangedContents(BuilderParticipant.java:291)
at org.eclipse.xtext.builder.BuilderParticipant.build(BuilderParticipant.java:221)
at org.eclipse.xtext.builder.impl.RegistryBuilderParticipant.build(RegistryBuilderParticipant.java:60)
at org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBuilder.java:170)
at org.eclipse.xtext.builder.impl.XtextBuilder.incrementalBuild(XtextBuilder.java:146)
at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuilder.java:95)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:726)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

!ENTRY org.apache.log4j 4 0 2013-04-12 16:01:31.459
!MESSAGE org.eclipse.xtext.builder.BuilderParticipant - Error during compilation of 'platform:/resource/sad/src/NewTryFile.dmodel'.

!STACK 0
java.lang.IllegalArgumentException: Already known: //TODO\n
at net.sourceforge.plantuml.cucadiagram.CucaDiagram.createLeaf(Unknown Source)
at net.sourceforge.plantuml.activitydiagram.ActivityDiagram.createLeaf(Unknown Source)
at net.sourceforge.plantuml.activitydiagram.command.CommandLinkLongActivity2.executeNow(Unknown Source)
at net.sourceforge.plantuml.command.CommandMultilines2.execute(Unknown Source)
at net.sourceforge.plantuml.PSystemSingleBuilder.manageMultiline(Unknown Source)
at net.sourceforge.plantuml.PSystemSingleBuilder.executeUmlCommand(Unknown Source)
at net.sourceforge.plantuml.PSystemSingleBuilder.<init>(Unknown Source)
at net.sourceforge.plantuml.PSystemBuilder.createPSystem(Unknown Source)
at net.sourceforge.plantuml.BlockUml.createSystem(Unknown Source)
at net.sourceforge.plantuml.BlockUml.getSystem(Unknown Source)
at net.sourceforge.plantuml.SourceStringReader.generateImage(Unknown Source)
at net.sourceforge.plantuml.SourceStringReader.generateImage(Unknown Source)
at net.sourceforge.plantuml.SourceStringReader.generateImage(Unknown Source)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen._internalDoGenerate(MySuperGen.java:104)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen.internalDoGenerate(MySuperGen.java:197)
at org.eclipse.xtext.xbase.compiler.JvmModelGenerator.doGenerate(JvmModelGenerator.java:181)
at org.eclipse.xtext.builder.BuilderParticipant.handleChangedContents(BuilderParticipant.java:291)
at org.eclipse.xtext.builder.BuilderParticipant.build(BuilderParticipant.java:221)
at org.eclipse.xtext.builder.impl.RegistryBuilderParticipant.build(RegistryBuilderParticipant.java:60)
at org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBuilder.java:170)
at org.eclipse.xtext.builder.impl.XtextBuilder.incrementalBuild(XtextBuilder.java:146)
at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuilder.java:95)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:726)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)




Christian Dietrich wrote on Fri, 12 April 2013 09:54
def dispatch CharSequence print(XFeatureCall e)

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1039744 is a reply to message #1039726] Fri, 12 April 2013 14:25 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Please share all Print methods

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1039745 is a reply to message #1039726] Fri, 12 April 2013 14:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi looks like did not all . if so the method should not write any
todos. Create the .txt files instead of pngs for debugging

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1039748 is a reply to message #1039744] Fri, 12 April 2013 14:33 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
The "Print" methods are as follows.
def dispatch print(XExpression e) '''
//TODO
'''
/*def dispatch print(XBlockExpression e) '''
«FOR ex : e.expressions»
«ex.print»
«ENDFOR»
'''*/

def dispatch print(XBlockExpression e) '''
@startuml
(*)«FOR ex : e.expressions SEPARATOR "\n"»--> "«ex.print»"«ENDFOR»
--> (*)
@enduml

'''
def dispatch CharSequence print(XFeatureCall e)
'''«e.feature.simpleName»'''

Christian Dietrich wrote on Fri, 12 April 2013 10:25
Please share all Print methods

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1039751 is a reply to message #1039748] Fri, 12 April 2013 14:36 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Now I think, the reason is that I changed the "op activityInOneDay()", now it has a "if" inside it.
op activityInOneDay(): void {

if (getUp())
{
haveBreakfast();
}
haveBreakfast();

workAtHome();
haveLunch();
}
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1039752 is a reply to message #1039751] Fri, 12 April 2013 14:38 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
I told you to add a print method for XIfExpression too

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1039756 is a reply to message #1039752] Fri, 12 April 2013 14:42 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Yes, just need time. I just realized maybe this is the reason.
Christian Dietrich wrote on Fri, 12 April 2013 10:38
I told you to add a print method for XIfExpression too

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1039763 is a reply to message #1039756] Fri, 12 April 2013 14:55 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
How could I see the declaration of "XExpression", "XFeatureCall " and "XIfExpression "? It is difficult to guess the properties and methods of them, because there is no content assistent.

[Updated on: Fri, 12 April 2013 14:56]

Report message to a moderator

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1039772 is a reply to message #1039763] Fri, 12 April 2013 15:10 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi there should be content assist. In doubt switch to a java util

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1039777 is a reply to message #1039772] Fri, 12 April 2013 15:24 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Yes, because I have a confliction about the "Ctrl+Space". I add a "print" method for "XIfExpression", as shown in the following. The error information is as follows.


def dispatch CharSequence print(XIfExpression e)
'''if «e.^if.print» then
-->[true]«e.then.print»
else
-->[false]«e.^else.print»
endif
'''

def dispatch print(XExpression e) '''
//TODO
'''
/*def dispatch print(XBlockExpression e) '''
«FOR ex : e.expressions»
«ex.print»
«ENDFOR»
'''*/

def dispatch print(XBlockExpression e) '''
@startuml
(*)«FOR ex : e.expressions SEPARATOR "\n"»--> "«ex.print»"«ENDFOR»
--> (*)
@enduml

'''
def dispatch CharSequence print(XFeatureCall e)
'''«e.feature.simpleName»'''


!SESSION 2013-04-12 17:21:51.923 -----------------------------------------------
eclipse.buildId=M20130204-1200
java.version=1.7.0_17
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments: -product org.eclipse.sdk.ide
Command-line arguments: -product org.eclipse.sdk.ide -data D:\TodayNewEight/../runtime-TodayNewEight -dev file:D:/TodayNewEight/.metadata/.plugins/org.eclipse.pde.core/New_configuration/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog

!ENTRY org.eclipse.update.configurator 4 0 2013-04-12 17:21:53.498
!MESSAGE Unable to find feature.xml in directory: C:\eclipsexText64\features\org.eclipse.equinox.p2.discovery.feature_1.0.100.v20120524-0542-4-Bh9oB58A5N9L28PCQ

!ENTRY org.eclipse.egit.ui 2 0 2013-04-12 17:22:08.479
!MESSAGE Warning: EGit couldn't detect the installation path "gitPrefix" of native Git. Hence EGit can't respect system level
Git settings which might be configured in ${gitPrefix}/etc/gitconfig under the native Git installation directory.
The most important of these settings is core.autocrlf. Git for Windows by default sets this parameter to true in
this system level configuration. The Git installation location can be configured on the
Team > Git > Configuration preference page's 'System Settings' tab.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.

!ENTRY org.eclipse.egit.ui 2 0 2013-04-12 17:22:08.479
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
user global configuration and to define the default location to store repositories: 'H:\'. If this is
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
EGit might behave differently since they see different configuration options.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
java.lang.IllegalArgumentException: Already known: //TODO\n
at net.sourceforge.plantuml.cucadiagram.CucaDiagram.createLeaf(Unknown Source)
at net.sourceforge.plantuml.activitydiagram.ActivityDiagram.createLeaf(Unknown Source)
at net.sourceforge.plantuml.activitydiagram.command.CommandLinkLongActivity2.executeNow(Unknown Source)
at net.sourceforge.plantuml.command.CommandMultilines2.execute(Unknown Source)
at net.sourceforge.plantuml.PSystemSingleBuilder.manageMultiline(Unknown Source)
at net.sourceforge.plantuml.PSystemSingleBuilder.executeUmlCommand(Unknown Source)
at net.sourceforge.plantuml.PSystemSingleBuilder.<init>(Unknown Source)
at net.sourceforge.plantuml.PSystemBuilder.createPSystem(Unknown Source)
at net.sourceforge.plantuml.BlockUml.createSystem(Unknown Source)
at net.sourceforge.plantuml.BlockUml.getSystem(Unknown Source)
at net.sourceforge.plantuml.SourceStringReader.generateImage(Unknown Source)
at net.sourceforge.plantuml.SourceStringReader.generateImage(Unknown Source)
at net.sourceforge.plantuml.eclipse.model.Diagram.getImage(Diagram.java:101)
at net.sourceforge.plantuml.eclipse.actions.GenerateAction.treatPlantUmlSelected(GenerateAction.java:216)
at net.sourceforge.plantuml.eclipse.views.PlantUmlView.updateDiagramText(PlantUmlView.java:146)
at net.sourceforge.plantuml.eclipse.views.AbstractDiagramSourceView.updateDiagramText(AbstractDiagramSourceView.java:100)
at net.sourceforge.plantuml.eclipse.views.AbstractDiagramSourceView.run(AbstractDiagramSourceView.java:40)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4144)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1053)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
java.lang.IllegalArgumentException: Already known: //TODO\n
at net.sourceforge.plantuml.cucadiagram.CucaDiagram.createLeaf(Unknown Source)
at net.sourceforge.plantuml.activitydiagram.ActivityDiagram.createLeaf(Unknown Source)
at net.sourceforge.plantuml.activitydiagram.command.CommandLinkLongActivity2.executeNow(Unknown Source)
at net.sourceforge.plantuml.command.CommandMultilines2.execute(Unknown Source)
at net.sourceforge.plantuml.PSystemSingleBuilder.manageMultiline(Unknown Source)
at net.sourceforge.plantuml.PSystemSingleBuilder.executeUmlCommand(Unknown Source)
at net.sourceforge.plantuml.PSystemSingleBuilder.<init>(Unknown Source)
at net.sourceforge.plantuml.PSystemBuilder.createPSystem(Unknown Source)
at net.sourceforge.plantuml.BlockUml.createSystem(Unknown Source)
at net.sourceforge.plantuml.BlockUml.getSystem(Unknown Source)
at net.sourceforge.plantuml.SourceStringReader.generateImage(Unknown Source)
at net.sourceforge.plantuml.SourceStringReader.generateImage(Unknown Source)
at net.sourceforge.plantuml.eclipse.model.Diagram.getImage(Diagram.java:101)
at net.sourceforge.plantuml.eclipse.actions.GenerateAction.treatPlantUmlSelected(GenerateAction.java:216)
at net.sourceforge.plantuml.eclipse.views.PlantUmlView.updateDiagramText(PlantUmlView.java:146)
at net.sourceforge.plantuml.eclipse.views.AbstractDiagramSourceView.updateDiagramText(AbstractDiagramSourceView.java:100)
at net.sourceforge.plantuml.eclipse.views.AbstractDiagramSourceView.access$0(AbstractDiagramSourceView.java:90)
at net.sourceforge.plantuml.eclipse.views.AbstractDiagramSourceView$DiagramTextChangedListener.diagramChanged(AbstractDiagramSourceView.java:73)
at net.sourceforge.plantuml.eclipse.views.AbstractDiagramSourceView$DiagramTextChangedListener.selectionChanged(AbstractDiagramSourceView.java:69)
at org.eclipse.ui.internal.e4.compatibility.SelectionService.notifyPostSelectionListeners(SelectionService.java:173)
at org.eclipse.ui.internal.e4.compatibility.SelectionService.access$4(SelectionService.java:170)
at org.eclipse.ui.internal.e4.compatibility.SelectionService$2.selectionChanged(SelectionService.java:86)
at org.eclipse.e4.ui.internal.workbench.SelectionAggregator$4.run(SelectionAggregator.java:156)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.e4.ui.internal.workbench.SelectionAggregator.notifyPostListeners(SelectionAggregator.java:154)
at org.eclipse.e4.ui.internal.workbench.SelectionAggregator.access$8(SelectionAggregator.java:151)
at org.eclipse.e4.ui.internal.workbench.SelectionAggregator$8$1.run(SelectionAggregator.java:253)
at org.eclipse.e4.core.contexts.RunAndTrack.runExternalCode(RunAndTrack.java:53)
at org.eclipse.e4.ui.internal.workbench.SelectionAggregator$8.changed(SelectionAggregator.java:251)
at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:110)
at org.eclipse.e4.core.internal.contexts.EclipseContext.processScheduled(EclipseContext.java:328)
at org.eclipse.e4.core.internal.contexts.EclipseContext.set(EclipseContext.java:342)
at org.eclipse.e4.ui.internal.workbench.SelectionServiceImpl.setPostSelection(SelectionServiceImpl.java:34)
at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart$3.selectionChanged(CompatibilityPart.java:126)
at org.eclipse.jface.text.TextViewer.firePostSelectionChanged(TextViewer.java:2755)
at org.eclipse.jface.text.TextViewer.firePostSelectionChanged(TextViewer.java:2703)
at org.eclipse.jface.text.TextViewer$5.run(TextViewer.java:2682)
at org.eclipse.swt.widgets.Display.runTimer(Display.java:4270)
at org.eclipse.swt.widgets.Display.messageProc(Display.java:3357)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2546)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3756)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
at org.eclipse.jface.window.Window.open(Window.java:801)
at org.eclipse.jface.dialogs.MessageDialog.open(MessageDialog.java:334)
at org.eclipse.jface.dialogs.MessageDialog.open(MessageDialog.java:364)
at org.eclipse.jface.dialogs.MessageDialog.openError(MessageDialog.java:431)
at net.sourceforge.plantuml.eclipse.utils.WorkbenchUtil.errorBox(WorkbenchUtil.java:128)
at net.sourceforge.plantuml.eclipse.model.Diagram.getImage(Diagram.java:120)
at net.sourceforge.plantuml.eclipse.actions.GenerateAction.treatPlantUmlSelected(GenerateAction.java:216)
at net.sourceforge.plantuml.eclipse.views.PlantUmlView.updateDiagramText(PlantUmlView.java:146)
at net.sourceforge.plantuml.eclipse.views.AbstractDiagramSourceView.updateDiagramText(AbstractDiagramSourceView.java:100)
at net.sourceforge.plantuml.eclipse.views.AbstractDiagramSourceView.run(AbstractDiagramSourceView.java:40)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4144)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3761)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1053)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
at org.eclipse.equinox.launcher.Main.main(Main.java:1414)
0 [Worker-6] ERROR org.eclipse.xtext.builder.BuilderParticipant - Error during compilation of 'platform:/resource/sad/src/NewTryFile.dmodel'.
java.lang.IllegalArgumentException: Unhandled parameter types: [null]
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen.print(MySuperGen.java:169)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen._print(MySuperGen.java:134)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen.print(MySuperGen.java:165)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen._print(MySuperGen.java:92)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen.print(MySuperGen.java:163)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen._internalDoGenerate(MySuperGen.java:54)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen.internalDoGenerate(MySuperGen.java:148)
at org.eclipse.xtext.xbase.compiler.JvmModelGenerator.doGenerate(JvmModelGenerator.java:181)
at org.eclipse.xtext.builder.BuilderParticipant.handleChangedContents(BuilderParticipant.java:291)
at org.eclipse.xtext.builder.BuilderParticipant.build(BuilderParticipant.java:221)
at org.eclipse.xtext.builder.impl.RegistryBuilderParticipant.build(RegistryBuilderParticipant.java:60)
at org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBuilder.java:170)
at org.eclipse.xtext.builder.impl.XtextBuilder.fullBuild(XtextBuilder.java:194)
at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuilder.java:89)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:726)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:321)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:396)
at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
at org.eclipse.core.internal.resources.Project.build(Project.java:124)
at org.eclipse.xtext.builder.impl.BuildScheduler$BuildJob.run(BuildScheduler.java:178)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

!ENTRY org.apache.log4j 4 0 2013-04-12 17:22:10.540
!MESSAGE org.eclipse.xtext.builder.BuilderParticipant - Error during compilation of 'platform:/resource/sad/src/NewTryFile.dmodel'.

!STACK 0
java.lang.IllegalArgumentException: Unhandled parameter types: [null]
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen.print(MySuperGen.java:169)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen._print(MySuperGen.java:134)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen.print(MySuperGen.java:165)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen._print(MySuperGen.java:92)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen.print(MySuperGen.java:163)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen._internalDoGenerate(MySuperGen.java:54)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen.internalDoGenerate(MySuperGen.java:148)
at org.eclipse.xtext.xbase.compiler.JvmModelGenerator.doGenerate(JvmModelGenerator.java:181)
at org.eclipse.xtext.builder.BuilderParticipant.handleChangedContents(BuilderParticipant.java:291)
at org.eclipse.xtext.builder.BuilderParticipant.build(BuilderParticipant.java:221)
at org.eclipse.xtext.builder.impl.RegistryBuilderParticipant.build(RegistryBuilderParticipant.java:60)
at org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBuilder.java:170)
at org.eclipse.xtext.builder.impl.XtextBuilder.fullBuild(XtextBuilder.java:194)
at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuilder.java:89)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:726)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:321)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:396)
at org.eclipse.core.internal.resources.Project$1.run(Project.java:618)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at org.eclipse.core.internal.resources.Project.internalBuild(Project.java:597)
at org.eclipse.core.internal.resources.Project.build(Project.java:124)
at org.eclipse.xtext.builder.impl.BuildScheduler$BuildJob.run(BuildScheduler.java:178)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
1414 [Worker-1] ERROR org.eclipse.xtext.builder.BuilderParticipant - Error during compilation of 'platform:/resource/sad/src/NewTryFile.dmodel'.
java.lang.IllegalArgumentException: Unhandled parameter types: [null]
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen.print(MySuperGen.java:169)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen._print(MySuperGen.java:134)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen.print(MySuperGen.java:165)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen._print(MySuperGen.java:92)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen.print(MySuperGen.java:163)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen._internalDoGenerate(MySuperGen.java:54)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen.internalDoGenerate(MySuperGen.java:148)
at org.eclipse.xtext.xbase.compiler.JvmModelGenerator.doGenerate(JvmModelGenerator.java:181)
at org.eclipse.xtext.builder.BuilderParticipant.handleChangedContents(BuilderParticipant.java:291)
at org.eclipse.xtext.builder.BuilderParticipant.build(BuilderParticipant.java:221)
at org.eclipse.xtext.builder.impl.RegistryBuilderParticipant.build(RegistryBuilderParticipant.java:60)
at org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBuilder.java:170)
at org.eclipse.xtext.builder.impl.XtextBuilder.incrementalBuild(XtextBuilder.java:146)
at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuilder.java:95)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:726)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

!ENTRY org.apache.log4j 4 0 2013-04-12 17:22:11.969
!MESSAGE org.eclipse.xtext.builder.BuilderParticipant - Error during compilation of 'platform:/resource/sad/src/NewTryFile.dmodel'.

!STACK 0
java.lang.IllegalArgumentException: Unhandled parameter types: [null]
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen.print(MySuperGen.java:169)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen._print(MySuperGen.java:134)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen.print(MySuperGen.java:165)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen._print(MySuperGen.java:92)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen.print(MySuperGen.java:163)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen._internalDoGenerate(MySuperGen.java:54)
at org.eclipse.xtext.example.domainmodel.generator.MySuperGen.internalDoGenerate(MySuperGen.java:148)
at org.eclipse.xtext.xbase.compiler.JvmModelGenerator.doGenerate(JvmModelGenerator.java:181)
at org.eclipse.xtext.builder.BuilderParticipant.handleChangedContents(BuilderParticipant.java:291)
at org.eclipse.xtext.builder.BuilderParticipant.build(BuilderParticipant.java:221)
at org.eclipse.xtext.builder.impl.RegistryBuilderParticipant.build(RegistryBuilderParticipant.java:60)
at org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(XtextBuilder.java:170)
at org.eclipse.xtext.builder.impl.XtextBuilder.incrementalBuild(XtextBuilder.java:146)
at org.eclipse.xtext.builder.impl.XtextBuilder.build(XtextBuilder.java:95)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:726)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)



Christian Dietrich wrote on Fri, 12 April 2013 11:10
Hi there should be content assist. In doubt switch to a java util

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1039791 is a reply to message #1039777] Fri, 12 April 2013 15:45 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

i dont know if this working mode leads to anything.
what the generator does: it basically traverses the ast
if there is a todo generated you have something todo (captain obvious)

def dispatch CharSequence print(XExpression e) '''
//TODO + «e.eClass»
'''

might help

and of course a else can be null so you may have to handle this

this might help

def dispatch CharSequence print(Void e) '''

'''

and of course you might have to change the startuml enduml thing since if(){} is a xblockexpression too


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1040251 is a reply to message #1039791] Sat, 13 April 2013 08:43 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Yes. I would like to traverse the ast tree. I I have the tree, then I have the whole logic and the code.

Christian Dietrich wrote on Fri, 12 April 2013 11:45
Hi,

i dont know if this working mode leads to anything.
what the generator does: it basically traverses the ast
if there is a todo generated you have something todo (captain obvious)

def dispatch CharSequence print(XExpression e) '''
//TODO + «e.eClass»
'''

might help

and of course a else can be null so you may have to handle this

this might help

def dispatch CharSequence print(Void e) '''

'''

and of course you might have to change the startuml enduml thing since if(){} is a xblockexpression too

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1040299 is a reply to message #1040251] Sat, 13 April 2013 10:35 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
I modified the "print" methods. The problem is the activity sequence in-between is not correct. For example, the functions which are after "else" are connected with the "else" node. But in fact, they should be connected with the "then" node. I think, the problem is about the traverse of the ast tree. Could it be possible to obtain and traverse the ast tree? Then the sequence in-between would be not a problem.
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1040347 is a reply to message #1040299] Sat, 13 April 2013 12:09 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

you have the ast and travere it already ?!?
Or do you mean the concrete syntax tree aka node model? NodeModelUtil is your friend


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1040557 is a reply to message #1040347] Sat, 13 April 2013 20:13 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
I did not traverse the ast yet. I just modify the "print" methods. At the moment, I cannot traverse the ast and draw the activity diagram in a correct sequence. Aside from drawing the activity diagram, I also would like to get the code tree so that it could be possible to generate test case automatically.
NodeModeUtil is new to me. I would like to look into some documentation first in the internet. Thank you!
Christian Dietrich wrote on Sat, 13 April 2013 08:09
Hi,

you have the ast and travere it already ?!?
Or do you mean the concrete syntax tree aka node model? NodeModelUtil is your friend

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1040880 is a reply to message #1040557] Sun, 14 April 2013 08:26 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
I am searching examples of NodeModelUtils, but only found http://download.eclipse.org/modeling/tmf/xtext/javadoc/2.0.1/org/eclipse/xtext/nodemodel/util/NodeModelUtils.html. Could anybody provide me some more information? Thank you in advance!
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1040926 is a reply to message #1040880] Sun, 14 April 2013 10:13 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

having a look at the class could have given you

org.eclipse.xtext.nodemodel.util.NodeModelUtils.findActualNodeFor(EObject)
which gives org.eclipse.xtext.nodemodel.INode.getAsTreeIterable()


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1040940 is a reply to message #1040926] Sun, 14 April 2013 10:45 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Actually, yesterday I have found a good example, which can show exactly how to use NodeModelNutils. But now, I cannot find it again. It would like to find the example again, which have the example code how to embed the NodeModelUtils. Thank you for your reply!

Christian Dietrich wrote on Sun, 14 April 2013 06:13
Hi,

having a look at the class could have given you

org.eclipse.xtext.nodemodel.util.NodeModelUtils.findActualNodeFor(EObject)
which gives org.eclipse.xtext.nodemodel.INode.getAsTreeIterable()

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1041066 is a reply to message #1040926] Sun, 14 April 2013 15:10 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
It seems really not easy! I have to go forward step by step. I will try the NodeModelUtils to generate the activity diagrams first. Thank you!
Christian Dietrich wrote on Sun, 14 April 2013 06:13
Hi,

having a look at the class could have given you

org.eclipse.xtext.nodemodel.util.NodeModelUtils.findActualNodeFor(EObject)
which gives org.eclipse.xtext.nodemodel.INode.getAsTreeIterable()

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1041764 is a reply to message #1041066] Mon, 15 April 2013 14:38 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
I modfied the "print" methods as follows:

def dispatch internalDoGenerate(DomainModel m, IFileSystemAccess fsa
) {
for (e : m.eAllContents.toIterable.filter(typeof(Entity))) {

fsa.generateFile(e.fullyQualifiedName.toString+".txt",'''
«FOR op : e.features.filter(typeof(Operation))»
«op.name»:
««« @startuml
««« (*)
««« «FOR ex : op.body SEPARATOR "\n"» --> "«ex.print»"
«««
««« «ENDFOR»
««« --> (*)
««« @enduml
@startuml
««« (*) --> «op.body.print»
(*) --> «op.print»
--> (*)
@enduml
«ENDFOR»
''')

}
}


def dispatch print(Operation operation)'''
{
«val node = NodeModelUtils::findActualNodeFor(operation)»
«FOR oneNode : node.children»
«oneNode.print»
«ENDFOR»
}
'''

def dispatch CharSequence print(ICompositeNode curNode)
'''«FOR oneNode : curNode.children»
«IF oneNode instanceof XIfExpression»
"«oneNode.print»"
«ELSEIF oneNode instanceof XFeatureCall»
--> "«(oneNode as XFeatureCall).feature.simpleName»"
«ENDIF»
«ENDFOR»'''

def dispatch CharSequence print(ILeafNode curNode)
'''-->"«curNode.text»"'''

The behavior code in the ".dmodel" file is as follows:
op activityInOneDay(): void {
//if (getUp())
//{
haveBreakfast();
//}

workAtHome();
haveLunch();
}

In the end, the generated ".txt" file is as follows:

activityInOneDay:
@startuml
(*) --> {
}
--> (*)
@enduml

I have no idea how to print the behavior and get the activity diagram by using "NodeModelUtils". Hope somebody could provide some information. Thank you in advance!

[Updated on: Mon, 15 April 2013 14:39]

Report message to a moderator

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1041849 is a reply to message #1041764] Mon, 15 April 2013 17:00 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

the nodes are the text, so instanceof will never work

so do you want to traverse the AST (EObjects) or the CST (Nodes) or both?

for the CST two hints:
- node.getText() gives you the text in the file
- node.getGrammarElement() gives you an EObject that describes what xtext actually did
this may be: Assignment, RuleCall, CrossReference etc. (by downcasting you get more infos)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1041922 is a reply to message #1041849] Mon, 15 April 2013 19:18 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Thank you very much for your reply!
At the moment, I would like to generate an activity diagram based on the behavior (function) code, which might include the "for", "while", or "switch" statement. Honestly, I do not know I have to traverse the AST or CST or both. Thank you again!

By the way, what is "RuleCall" and "downcasting"?
Christian Dietrich wrote on Mon, 15 April 2013 13:00
Hi,

the nodes are the text, so instanceof will never work

so do you want to traverse the AST (EObjects) or the CST (Nodes) or both?

for the CST two hints:
- node.getText() gives you the text in the file
- node.getGrammarElement() gives you an EObject that describes what xtext actually did
this may be: Assignment, RuleCall, CrossReference etc. (by downcasting you get more infos)

[Updated on: Mon, 15 April 2013 19:19]

Report message to a moderator

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1041925 is a reply to message #1041922] Mon, 15 April 2013 19:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

i the only thing i can recommend is: use the debugger. see what is there.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1041955 is a reply to message #1041925] Mon, 15 April 2013 20:24 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Is it possible to debug the nodeModelUtil? Currently, I can only see the result in the run-time eclipse. Do you mean it is possible to debug the variables in the "print" methods?

Christian Dietrich wrote on Mon, 15 April 2013 15:23
Hi,

i the only thing i can recommend is: use the debugger. see what is there.

[Updated on: Mon, 15 April 2013 20:26]

Report message to a moderator

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1041963 is a reply to message #1041955] Mon, 15 April 2013 20:37 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Yes debug the print method. start the runtime in debug mode.

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1041964 is a reply to message #1041963] Mon, 15 April 2013 20:38 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Cool!! I will try tomorrow! Good night!
Christian Dietrich wrote on Mon, 15 April 2013 16:37
Yes debug the print method. start the runtime in debug mode.

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1042314 is a reply to message #1041963] Tue, 16 April 2013 09:06 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
First, I can debug the "print" method. But, suddenly, I cannot catch the "breakpoints" that I have marked and the ".txt"files, ".java" files all disappear in the run-time eclipse. Now, I can only have the information in the "Console", which can be seen as follows. What might be the reason?

Besides this, I have not found the right function to traverse the "children" of an "operation". So hard....

!SESSION 2013-04-16 11:00:42.174 -----------------------------------------------
eclipse.buildId=M20130204-1200
java.version=1.7.0_17
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments: -product org.eclipse.sdk.ide
Command-line arguments: -product org.eclipse.sdk.ide -data D:\TodayNewEight/../runtime-TodayNewEight -dev file:D:/TodayNewEight/.metadata/.plugins/org.eclipse.pde.core/New_configuration/dev.properties -os win32 -ws win32 -arch x86_64 -consoleLog

!ENTRY org.eclipse.update.configurator 4 0 2013-04-16 11:00:43.625
!MESSAGE Unable to find feature.xml in directory: C:\eclipsexText64\features\org.eclipse.equinox.p2.discovery.feature_1.0.100.v20120524-0542-4-Bh9oB58A5N9L28PCQ

!ENTRY org.eclipse.egit.ui 2 0 2013-04-16 11:00:58.181
!MESSAGE Warning: EGit couldn't detect the installation path "gitPrefix" of native Git. Hence EGit can't respect system level
Git settings which might be configured in ${gitPrefix}/etc/gitconfig under the native Git installation directory.
The most important of these settings is core.autocrlf. Git for Windows by default sets this parameter to true in
this system level configuration. The Git installation location can be configured on the
Team > Git > Configuration preference page's 'System Settings' tab.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.

!ENTRY org.eclipse.egit.ui 2 0 2013-04-16 11:00:58.181
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
user global configuration and to define the default location to store repositories: 'H:\'. If this is
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
EGit might behave differently since they see different configuration options.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.

[Updated on: Tue, 16 April 2013 09:10]

Report message to a moderator

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1042332 is a reply to message #1042314] Tue, 16 April 2013 09:34 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Sorry no idea

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1042385 is a reply to message #1042332] Tue, 16 April 2013 11:07 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Sorry, just found that I did not select "Build Automatically" for the project in the run-time eclipse.
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1043099 is a reply to message #1041849] Wed, 17 April 2013 09:24 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Here, just want to say: I still cannot get the point how to traverse the NodeModelUtils and get the plantuml string.
Currently, the "print" method is as follows. I hope somebody could give me some more hints.

def dispatch print(XBlockExpression e)'''
{
«FOR ex : e.expressions»
«val curExpressionNode = NodeModelUtils::findActualNodeFor(ex)»
«val NodeStr = NodeModelUtils::compactDump(curExpressionNode, true)»
«val firstChild = curExpressionNode.firstChild»
«val iterator = curExpressionNode.getAsTreeIterable().iterator()»
«while (iterator.hasNext()) {
var child = iterator.next()
var currentSemanticElement = NodeModelUtils::findActualSemanticObjectFor(child)
if (currentSemanticElement instanceof XExpression)
{
var tt = 2
}
else if (currentSemanticElement instanceof XIfExpression)
{
var rr =3
}

var curNodeText = child.text
var grammarElement = child.getGrammarElement()
val curSematicObj = child.semanticElement
if (grammarElement instanceof RuleCall)
{
var str = "RuleCall"
var ruleCall = (grammarElement as RuleCall).getRule()
var i = 11
// var strRuleCall = NodeModelUtils::getNode(ruleCall).getText();

}
else if (grammarElement instanceof ParserRule)
{
var str = "ParserRule"

}

else if (grammarElement instanceof Keyword)
{
var str = "Keyword"

}
else if (grammarElement instanceof CrossReference)
{
var str = "CrossReference"
var crossRef = (grammarElement as CrossReference).getTerminal()
// var labelStr = getLabel(grammarElement);

}
else if (grammarElement instanceof AbstractRule)
{
var str = "CrossReference"
var abstractRule = grammarElement as AbstractRule
}
}

»


«val curGrammarObj = curExpressionNode.grammarElement»
«IF (curGrammarObj instanceof RuleCall)»
«val rule = (curGrammarObj as RuleCall).getRule()»
«ENDIF»
«val curSematicObj = curExpressionNode.semanticElement»
«val curDirectSematicObj = NodeModelUtils::findActualSemanticObjectFor(curExpressionNode)»
«val curNodeText = curExpressionNode.text»
««« «FOR subexp: curSematicObj.expressions»
««« «switch {
«««««« case e1 : er1
«««««« case e2 : er2
«««««« ...
«««««« case en : ern
«««««« default : er
««« } »
««« «ENDFOR»
«val curcurSematicObjNode = NodeModelUtils::findActualNodeFor(curSematicObj)»
«val curcursubSematicObj = curcurSematicObjNode.firstChild»
«val anotherObj = curcursubSematicObj.semanticElement»
«val cursubDirectSematicObj = NodeModelUtils::findActualSemanticObjectFor(curcursubSematicObj)»

«val curStr = curExpressionNode.startLine.toString»
«ENDFOR»

««« «val node = NodeModelUtils::findActualNodeFor(operation)»
««« «FOR oneNode : node.getAsTreeIterable()»
««« «oneNode.print»
««« «ENDFOR»
}
'''
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1043116 is a reply to message #1043099] Wed, 17 April 2013 09:53 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

sorry i do not have the time do your work since it is NOT trivial. so it may be very hard for you as a beginner.
xbase is a gpl so the expressions to handle may be very very complex. too complex for an acitivity diagram.
this is why i am not sure if xbase is at all the right tool for your purpose.

never the less i still dont get the point why you dont use the ast traversal
as we started.

you would have implemented XIfExpression and everything would be fine.

(of course you have to structure the template so that it creates a plantuml valid output)

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1043124 is a reply to message #1043116] Wed, 17 April 2013 10:06 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Thank you for being there!
Do you mean the traverse of the "XExpression", "IfExpression" is the traverse of the ast tree already?

Christian Dietrich wrote on Wed, 17 April 2013 05:53
Hi,

sorry i do not have the time do your work since it is NOT trivial. so it may be very hard for you as a beginner.
xbase is a gpl so the expressions to handle may be very very complex. too complex for an acitivity diagram.
this is why i am not sure if xbase is at all the right tool for your purpose.

never the less i still dont get the point why you dont use the ast traversal
as we started.

you would have implemented XIfExpression and everything would be fine.

(of course you have to structure the template so that it creates a plantuml valid output)

~Christian

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1043141 is a reply to message #1043124] Wed, 17 April 2013 10:31 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Yes

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1043184 is a reply to message #1043141] Wed, 17 April 2013 11:41 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Sorry, the traverse of ast still has some problems.
For example, the "print" methods are as follows.

def dispatch internalDoGenerate(DomainModel m, IFileSystemAccess fsa
) {
for (e : m.eAllContents.toIterable.filter(typeof(Entity))) {

fsa.generateFile(e.fullyQualifiedName.toString+".txt",'''
«FOR op : e.features.filter(typeof(Operation))»
«op.name»:
@startuml
(*) --> «op.body.print»
--> (*)
@enduml
«ENDFOR»
''')

}
}

def dispatch CharSequence print(XIfExpression e)
// '''if «IF e.^if instanceof XFeatureCall» "«(e.^if as XFeatureCall).feature.simpleName»" «ENDIF» then
'''if "«e.^if.print»" then
-->[true] «e.then.print»
else
-->[false]«e.^else.print»
endif'''

def dispatch CharSequence print(XExpression e) '''
//TODO + «e.eClass»
'''

def dispatch CharSequence print(Void e) '''
"null"
'''

def dispatch print(XBlockExpression e) '''
«FOR ex : e.expressions SEPARATOR "\n"»«ex.print» «ENDFOR»
'''
def dispatch CharSequence print(XFeatureCall e)
'''--> "«e.feature.simpleName»"'''

The "op activityInOneDay()" is as follows.
op activityInOneDay(): void {

if (getUp())
{
haveBreakfast();
}
else
{
Sleep();
}
workAtHome();
haveLunch();
}

However, the generated plantuml string is as follows:

@startuml
(*) --> if "--> "getUp"" then
-->[true] --> "haveBreakfast"
else
-->[false]--> "Sleep"
endif
--> "workAtHome"
--> "haveLunch"
--> (*)
@enduml

But, the expected plantuml string is as follows. I have no idea how to get it from the "print" methods:
@startuml
(*) --> if " "getUp"" then
-->[true] "haveBreakfast"
else
-->[false]"Sleep"
endif
--> "workAtHome"
--> "haveLunch"
--> (*)
@enduml

Another problem is, even with the correct plantuml string, the generated activity diagram is as follows:
index.php/fa/14398/0/

As you might see from the image, the logic is not correct. Could you have some idea?
  • Attachment: Untitled.png
    (Size: 14.02KB, Downloaded 1279 times)

[Updated on: Wed, 17 April 2013 11:44]

Report message to a moderator

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1043215 is a reply to message #1043184] Wed, 17 April 2013 12:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Have a look at the print method? its everything there.
you may have e.g. move the -->
to the for loop and remove it from xfeaturecall.

if you have problems with xtend:
build the platuml string with plain java.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1043220 is a reply to message #1043215] Wed, 17 April 2013 12:42 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Thank you! I feel so stupid!
But I changed the "print" method as the follows.

def dispatch print(XBlockExpression e) '''
«FOR ex : e.expressions SEPARATOR "--> \n"»«ex.print» «ENDFOR»
'''
The generated plantuml string is as follows.
@startuml
(*) --> if ""getUp"" then
-->[true] "haveBreakfast"
else
-->[false]"Sleep"
endif-->
"workAtHome"-->
"haveLunch"

--> (*)
@enduml
But, it is supposed to be as the follows.

@startuml
(*) --> if "getUp" then
-->[true] "haveBreakfast"
else
->[false] "Sleep"
endif
--> "workAtHome"
--> "haveLunch"

--> (*)
@enduml

I need to generate the plantuml string at the same time with the code generation. "plain java" means normal ".java" files? I think I just did not understand the principles inside.

Christian Dietrich wrote on Wed, 17 April 2013 08:32
Have a look at the print method? its everything there.
you may have e.g. move the -->
to the for loop and remove it from xfeaturecall.

if you have problems with xtend:
build the platuml string with plain java.

~Christian

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1043236 is a reply to message #1043220] Wed, 17 April 2013 13:05 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Sorry!
The "print" method should be as follows.

def dispatch print(XBlockExpression e) '''
«FOR ex : e.expressions SEPARATOR " \n-->"» «ex.print» «ENDFOR»
'''

I still have one problem, the logic is not correct, as you might see from the following diagram.

index.php/fa/14399/0/
  • Attachment: Untitled.png
    (Size: 13.96KB, Downloaded 1169 times)
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1043240 is a reply to message #1043236] Wed, 17 April 2013 13:08 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Please let me think about it first.
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1043268 is a reply to message #1043240] Wed, 17 April 2013 13:42 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Sorry, I have no idea how to create the correct plantuml string whose logic is right.
I would like to stop here for one or two days.
But, thank you very very much for your help!

[Updated on: Wed, 17 April 2013 13:52]

Report message to a moderator

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1043854 is a reply to message #1043268] Thu, 18 April 2013 07:41 Go to previous messageGo to next message
Claudio Heeg is currently offline Claudio HeegFriend
Messages: 75
Registered: April 2013
Member
@startuml
(*) --> if "getUp" then
-->[true] "haveBreakfast"
--> "workAtHome"
else
->[false] "Sleep"
--> "workAtHome"
endif
--> "haveLunch"
--> (*)
@enduml

That is the logic you are looking for, just to clarify?
I guess you'd just have to put the first expression outside an if-else-block at the end of either block, so some sort of look-ahead.
That's just off the top of my head, though.

[Updated on: Thu, 18 April 2013 07:43]

Report message to a moderator

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1043948 is a reply to message #1043854] Thu, 18 April 2013 09:56 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Thank you for your reply!
No, the logic in the following plantuml string is not correct. I have no idea how to get the right logic out of the funtion which has been defined in the .dmodel file, e.g. the "op ActivityInOneDay". Could you provide some informaton about the "look-ahead"? I think this is a general problem if I want to automatically generate the plantuml string.
Claudio Heeg wrote on Thu, 18 April 2013 03:41
@startuml
(*) --> if "getUp" then
-->[true] "haveBreakfast"
--> "workAtHome"
else
->[false] "Sleep"
--> "workAtHome"
endif
--> "haveLunch"
--> (*)
@enduml

That is the logic you are looking for, just to clarify?
I guess you'd just have to put the first expression outside an if-else-block at the end of either block, so some sort of look-ahead.
That's just off the top of my head, though.

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1043954 is a reply to message #1043948] Thu, 18 April 2013 10:03 Go to previous messageGo to next message
Claudio Heeg is currently offline Claudio HeegFriend
Messages: 75
Registered: April 2013
Member
Well, first, I think, you should look into the PlantUML file and describe it correctly, so you know exactly what kind of code generation you're looking for.
From there you could probably change the generator accordingly.

My understanding was that you wanted a model as I described, that would also be according to the dmodel file as far as I can tell.
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1043958 is a reply to message #1043954] Thu, 18 April 2013 10:10 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
The expected plantuml string would be as follows, as to this example. In order to get the correct plantuml string, do I have to know the traverse sequence of the ast tree? Thank you in advance!

@startuml
(*) --> if "getUp" then
-->[true] "haveBreakfast"
--> "workAtHome"
--> "haveLunch"
--> (*)
else
->[false] "Sleep"
endif
--> (*)
@endum
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1043964 is a reply to message #1043958] Thu, 18 April 2013 10:16 Go to previous messageGo to next message
Claudio Heeg is currently offline Claudio HeegFriend
Messages: 75
Registered: April 2013
Member
I'm sorry, but could you provide the current version of the operation you're trying to generate the diagram from (i.e. the operation in the .dmodel-File)?
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1043968 is a reply to message #1043958] Thu, 18 April 2013 10:21 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Of course! Thank you in advance!

The "op activityInOneDay()" is as follows.

op activityInOneDay(): void {
if (getUp())
{
haveBreakfast();
}
else
{
Sleep();
}
workAtHome();
haveLunch();
}
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1043971 is a reply to message #1043968] Thu, 18 April 2013 10:28 Go to previous messageGo to next message
Claudio Heeg is currently offline Claudio HeegFriend
Messages: 75
Registered: April 2013
Member
I see - but doesn't that operation describe something different from what you actually want?
Unless I'm missing something, like this you'd only have an option between having breakfast or sleeping, after that working at home and having lunch happen anyway, due to them not being outside of the selection.

op activityInOneDay(): void {
  if (getUp()) {
    haveBreakfast();
    workAtHome();
    haveLunch();
  } else {
    Sleep();
  }
}

Shouldn't that be what you want? Again, I could be missing something here.

[Updated on: Thu, 18 April 2013 10:28]

Report message to a moderator

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1043982 is a reply to message #1043971] Thu, 18 April 2013 10:48 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Thank you for your attention!
Yes, you are right. I just take it as an example. What I actually want could be more complex. For example, the corrected "op activityInOneDay()" could be as follows.

op activityInOneDay(): void
{
if(getUp())
{
haveBreakfast();
workAtHome();
haveLunch();
return;
}
else
{
stayInBed();
if (hasGoodMood)
{
watchTV();
}
}
if (timeIsAfterElevenPM())
{
SleepInBedAgain();
}
return;
}

Since I do not have my work laptop with me. I cannot make sure that I can create a correct plantuml string.

Claudio Heeg wrote on Thu, 18 April 2013 06:28
I see - but doesn't that operation describe something different from what you actually want?
Unless I'm missing something, like this you'd only have an option between having breakfast or sleeping, after that working at home and having lunch happen anyway, due to them not being outside of the selection.

op activityInOneDay(): void {
  if (getUp()) {
    haveBreakfast();
    workAtHome();
    haveLunch();
  } else {
    Sleep();
  }
}

Shouldn't that be what you want? Again, I could be missing something here.

[Updated on: Thu, 18 April 2013 10:54]

Report message to a moderator

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1043985 is a reply to message #1043982] Thu, 18 April 2013 10:54 Go to previous messageGo to next message
Claudio Heeg is currently offline Claudio HeegFriend
Messages: 75
Registered: April 2013
Member
Well, to cover those cases, you'll have to change the editor accordingly, easy as that.
What you would want to do, I think, would be firstly checking if there is a return statement in any of the branches, and if there is, terminate that activity with --> (*). If there's not, you could look at the next statement outside the if/else and add it to the end of either branch.
That's just a spontaneous idea of how to get a proper diagram going, as for the concrete generator implementation, that's your task.
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1043990 is a reply to message #1043985] Thu, 18 April 2013 11:02 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Yes, this is my task. Thank you very much for your idea!
Claudio Heeg wrote on Thu, 18 April 2013 06:54
Well, to cover those cases, you'll have to change the editor accordingly, easy as that.
What you would want to do, I think, would be firstly checking if there is a return statement in any of the branches, and if there is, terminate that activity with --> (*). If there's not, you could look at the next statement outside the if/else and add it to the end of either branch.
That's just a spontaneous idea of how to get a proper diagram going, as for the concrete generator implementation, that's your task.

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1044721 is a reply to message #1043990] Fri, 19 April 2013 08:45 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
I think this is the basic idea to draw a correct activity diagram.
Hao Zhang wrote on Thu, 18 April 2013 07:02
Yes, this is my task. Thank you very much for your idea!
Claudio Heeg wrote on Thu, 18 April 2013 06:54
Well, to cover those cases, you'll have to change the editor accordingly, easy as that.
What you would want to do, I think, would be firstly checking if there is a return statement in any of the branches, and if there is, terminate that activity with --> (*). If there's not, you could look at the next statement outside the if/else and add it to the end of either branch.
That's just a spontaneous idea of how to get a proper diagram going, as for the concrete generator implementation, that's your task.


Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1044948 is a reply to message #1044721] Fri, 19 April 2013 14:46 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Currently, the op activityInOneDay is as follows. I still cannot get the correct plantuml string.

op activityInOneDay(): void {
if (getUp())
{
haveBreakfast();
}
else
{
sleep();
return;
}
workAtHome();
haveLunch();
return;
}
The "print" methods are as follows:
def dispatch internalDoGenerate(DomainModel m, IFileSystemAccess fsa
) {
for (e : m.eAllContents.toIterable.filter(typeof(Entity))) {

fsa.generateFile(e.fullyQualifiedName.toString+".txt",'''
«FOR op : e.features.filter(typeof(Operation))»
«op.name»:
@startuml
(*) --> «op.body.print»
««« --> (*)
@enduml
«ENDFOR»
''')

}
}

def dispatch CharSequence print(XIfExpression e)
// '''if «IF e.^if instanceof XFeatureCall» "«(e.^if as XFeatureCall).feature.simpleName»" «ENDIF» then
'''if «e.^if.print» then
-->[true] «e.then.print»
else
-->[false]«e.^else.print»
endif'''

def dispatch CharSequence print(XExpression e) '''
//TODO + «e.eClass»

'''

def dispatch CharSequence print(Void e) '''
"null"
'''

def dispatch print(XBlockExpression e) '''
«FOR ex : e.expressions SEPARATOR " \n-->"» «ex.print» «ENDFOR»
'''
def dispatch CharSequence print(XFeatureCall e)
'''"«e.feature.simpleName»"'''

def dispatch CharSequence print(XMemberFeatureCall e)
// '''"«e.feature.simpleName»"'''
'''"«e.feature.identifier»"'''


def dispatch CharSequence print(XReturnExpression e)
'''(*)'''
The generated plantuml string is as follows:
@startuml
(*) --> if "getUp" then
-->[true] "haveBreakfast"
else
-->[false] "sleep"
--> (*)
endif
--> "workAtHome"
--> "haveLunch"
--> (*)
@enduml
But I am expecting the plantuml is :
@startuml
(*) --> if "getUp" then
-->[true] "haveBreakfast"
--> "workAtHome"
--> "haveLunch"
--> (*)
else
-->[false] "sleep"
--> (*)
endif

@enduml
Could anybody give me some hints how to create the correct plantuml string? Thank you in advance!

[Updated on: Fri, 19 April 2013 14:48]

Report message to a moderator

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1045032 is a reply to message #1044948] Fri, 19 April 2013 17:15 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

Your generator doesnt know anything about the semantics of return.
this is one reason why what you want to achieve is very hard with xbase.
cause you have to do control flow analysis. this is a huge field


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1045100 is a reply to message #1045032] Fri, 19 April 2013 19:27 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Thank you very much for your answer!
As you said, actually, I am trying to traverse the ast Tree. Could it be possible to traverse the tree with the specified sequence? What might be the solution to do the control flow analysis? Do you mean that it is not possible to achieve what I want to do with xbase?
Christian Dietrich wrote on Fri, 19 April 2013 13:15
Hi,

Your generator doesnt know anything about the semantics of return.
this is one reason why what you want to achieve is very hard with xbase.
cause you have to do control flow analysis. this is a huge field

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1045115 is a reply to message #1045100] Fri, 19 April 2013 20:01 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Everything is possible. same as before: if you dont feel comfortable with xtend do the traveral in java

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1045157 is a reply to message #1045115] Fri, 19 April 2013 21:31 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Yes! But how could I do the control flow analysis based on current "print" methods? I really have no idea...
Christian Dietrich wrote on Fri, 19 April 2013 16:01
Everything is possible. same as before: if you dont feel comfortable with xtend do the traveral in java

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1045420 is a reply to message #1045157] Sat, 20 April 2013 07:54 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Sorry i dont believe what we are doing here leads to anything.
it is an algorithmic thing that has nothing todo with xtext.

one problem is that plantuml syntax sucks at this point

the flollowing might be a starting point it might be a dead end too.
and you will ask again and i will not have the time to do the job!
class MySuperGen extends JvmModelGenerator {
	
	@Inject extension IQualifiedNameProvider
	
	def dispatch internalDoGenerate(DomainModel m, IFileSystemAccess fsa
	) {
		for (e : m.eAllContents.toIterable.filter(typeof(Entity))) {
			for (op : e.features.filter(typeof(Operation))) {
				val content = '''
				@startuml
(*) --> «op.body.print(newArrayList(),"")»
«««	 --> (*)
@enduml
			'''.toString
				
					fsa.generateFile(op.fullyQualifiedName.toString+".txt",content)
				if (fsa instanceof IFileSystemAccessExtension3) {
					val out = new ByteArrayOutputStream()
				new SourceStringReader(content).generateImage(out)
					(fsa as IFileSystemAccessExtension3).generateFile(op.fullyQualifiedName.toString+".png",new ByteArrayInputStream(out.toByteArray))
				} else {
				}	
			}
		}
	}
	
	

def dispatch CharSequence print(XIfExpression e, List<XExpression> queue, String iffi) 
//	'''if «IF e.^if instanceof XFeatureCall» "«(e.^if as XFeatureCall).feature.simpleName»"	«ENDIF» then 
'''if TODO then 
«e.then.print(queue,"[true]")»
else
«e.^else.print(queue, "[false]")»	
endif'''

def dispatch CharSequence print(XExpression e, List<XExpression> queue, String iffi) '''
//TODO + «e.eClass»
«handleQueue(queue,"")»
'''

def dispatch CharSequence print(Void e, List<XExpression> queue, String iffi) '''
--> «iffi» "null"
«handleQueue(queue,"")»
'''

def dispatch print(XBlockExpression e, List<XExpression> queue, String iffi)
{
	val newQueue = newArrayList()
	newQueue.addAll(e.expressions)
	newQueue.addAll(queue)
	handleQueue(newQueue, iffi)
}

def handleQueue(List<XExpression> queue, String iffi) {
	if (queue.size > 0) {
		print(queue.head, queue.tail.toList, iffi)
	} else {
		''''''
	}	
}

def dispatch CharSequence print(XFeatureCall e, List<XExpression> queue, String iffi) 
'''--> «iffi» "«e.feature.simpleName»"
«handleQueue(queue, "")»'''

def dispatch CharSequence print(XMemberFeatureCall e, List<XExpression> queue, String iffi) 
//	'''"«e.feature.simpleName»"'''
'''--> «iffi» "«e.feature.identifier»"
«handleQueue(queue,"")»'''


def dispatch CharSequence print(XReturnExpression e, List<XExpression> queue, String iffi) 
'''--> (*)'''
	
}


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1045446 is a reply to message #1045420] Sat, 20 April 2013 08:46 Go to previous messageGo to next message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
Thank you for your time and your help for the long time!!
I really appreciate very much your help. I will try your code on the coming Monday.
I am wondering if xtext or xbase can provide API for the generated ast tree, like a visitor() method with the defined LL(1)? It is really hard for people who are not from computer science.And I hope plantuml could pay attention to this problem in the future.

Christian Dietrich wrote on Sat, 20 April 2013 03:54
Sorry i dont believe what we are doing here leads to anything.
it is an algorithmic thing that has nothing todo with xtext.

one problem is that plantuml syntax sucks at this point

the flollowing might be a starting point it might be a dead end too.
and you will ask again and i will not have the time to do the job!
class MySuperGen extends JvmModelGenerator {
	
	@Inject extension IQualifiedNameProvider
	
	def dispatch internalDoGenerate(DomainModel m, IFileSystemAccess fsa
	) {
		for (e : m.eAllContents.toIterable.filter(typeof(Entity))) {
			for (op : e.features.filter(typeof(Operation))) {
				val content = '''
				@startuml
(*) --> «op.body.print(newArrayList(),"")»
«««	 --> (*)
@enduml
			'''.toString
				
					fsa.generateFile(op.fullyQualifiedName.toString+".txt",content)
				if (fsa instanceof IFileSystemAccessExtension3) {
					val out = new ByteArrayOutputStream()
				new SourceStringReader(content).generateImage(out)
					(fsa as IFileSystemAccessExtension3).generateFile(op.fullyQualifiedName.toString+".png",new ByteArrayInputStream(out.toByteArray))
				} else {
				}	
			}
		}
	}
	
	

def dispatch CharSequence print(XIfExpression e, List<XExpression> queue, String iffi) 
//	'''if «IF e.^if instanceof XFeatureCall» "«(e.^if as XFeatureCall).feature.simpleName»"	«ENDIF» then 
'''if TODO then 
«e.then.print(queue,"[true]")»
else
«e.^else.print(queue, "[false]")»	
endif'''

def dispatch CharSequence print(XExpression e, List<XExpression> queue, String iffi) '''
//TODO + «e.eClass»
«handleQueue(queue,"")»
'''

def dispatch CharSequence print(Void e, List<XExpression> queue, String iffi) '''
--> «iffi» "null"
«handleQueue(queue,"")»
'''

def dispatch print(XBlockExpression e, List<XExpression> queue, String iffi)
{
	val newQueue = newArrayList()
	newQueue.addAll(e.expressions)
	newQueue.addAll(queue)
	handleQueue(newQueue, iffi)
}

def handleQueue(List<XExpression> queue, String iffi) {
	if (queue.size > 0) {
		print(queue.head, queue.tail.toList, iffi)
	} else {
		''''''
	}	
}

def dispatch CharSequence print(XFeatureCall e, List<XExpression> queue, String iffi) 
'''--> «iffi» "«e.feature.simpleName»"
«handleQueue(queue, "")»'''

def dispatch CharSequence print(XMemberFeatureCall e, List<XExpression> queue, String iffi) 
//	'''"«e.feature.simpleName»"'''
'''--> «iffi» "«e.feature.identifier»"
«handleQueue(queue,"")»'''


def dispatch CharSequence print(XReturnExpression e, List<XExpression> queue, String iffi) 
'''--> (*)'''
	
}

[Updated on: Sat, 20 April 2013 10:51]

Report message to a moderator

Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1046683 is a reply to message #1045420] Mon, 22 April 2013 08:21 Go to previous message
Hao Zhang is currently offline Hao ZhangFriend
Messages: 107
Registered: April 2013
Senior Member
So far as now, the code works perfect. Thank you very much for your contribution!

Christian Dietrich wrote on Sat, 20 April 2013 03:54
Sorry i dont believe what we are doing here leads to anything.
it is an algorithmic thing that has nothing todo with xtext.

one problem is that plantuml syntax sucks at this point

the flollowing might be a starting point it might be a dead end too.
and you will ask again and i will not have the time to do the job!
class MySuperGen extends JvmModelGenerator {
	
	@Inject extension IQualifiedNameProvider
	
	def dispatch internalDoGenerate(DomainModel m, IFileSystemAccess fsa
	) {
		for (e : m.eAllContents.toIterable.filter(typeof(Entity))) {
			for (op : e.features.filter(typeof(Operation))) {
				val content = '''
				@startuml
(*) --> «op.body.print(newArrayList(),"")»
«««	 --> (*)
@enduml
			'''.toString
				
					fsa.generateFile(op.fullyQualifiedName.toString+".txt",content)
				if (fsa instanceof IFileSystemAccessExtension3) {
					val out = new ByteArrayOutputStream()
				new SourceStringReader(content).generateImage(out)
					(fsa as IFileSystemAccessExtension3).generateFile(op.fullyQualifiedName.toString+".png",new ByteArrayInputStream(out.toByteArray))
				} else {
				}	
			}
		}
	}
	
	

def dispatch CharSequence print(XIfExpression e, List<XExpression> queue, String iffi) 
//	'''if «IF e.^if instanceof XFeatureCall» "«(e.^if as XFeatureCall).feature.simpleName»"	«ENDIF» then 
'''if TODO then 
«e.then.print(queue,"[true]")»
else
«e.^else.print(queue, "[false]")»	
endif'''

def dispatch CharSequence print(XExpression e, List<XExpression> queue, String iffi) '''
//TODO + «e.eClass»
«handleQueue(queue,"")»
'''

def dispatch CharSequence print(Void e, List<XExpression> queue, String iffi) '''
--> «iffi» "null"
«handleQueue(queue,"")»
'''

def dispatch print(XBlockExpression e, List<XExpression> queue, String iffi)
{
	val newQueue = newArrayList()
	newQueue.addAll(e.expressions)
	newQueue.addAll(queue)
	handleQueue(newQueue, iffi)
}

def handleQueue(List<XExpression> queue, String iffi) {
	if (queue.size > 0) {
		print(queue.head, queue.tail.toList, iffi)
	} else {
		''''''
	}	
}

def dispatch CharSequence print(XFeatureCall e, List<XExpression> queue, String iffi) 
'''--> «iffi» "«e.feature.simpleName»"
«handleQueue(queue, "")»'''

def dispatch CharSequence print(XMemberFeatureCall e, List<XExpression> queue, String iffi) 
//	'''"«e.feature.simpleName»"'''
'''--> «iffi» "«e.feature.identifier»"
«handleQueue(queue,"")»'''


def dispatch CharSequence print(XReturnExpression e, List<XExpression> queue, String iffi) 
'''--> (*)'''
	
}

Previous Topic:Xtext Grammar - Referencing
Next Topic:Build path specifies execution environment J2SE-1.5.
Goto Forum:
  


Current Time: Fri Apr 26 06:30:28 GMT 2024

Powered by FUDForum. Page generated in 0.07807 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top