|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Is it possible to export the behaviors in the .dmodel file into diagram like UML's activity diag [message #1039489 is a reply to message #1039479] |
Fri, 12 April 2013 04:14   |
Eclipse User |
|
|
|
The content of the "MANIFEST.MF" of the "domainmodel" project is as follows. Does this mean I can get generated UML activity diagram via the adopted generator which is defined in the "class MySuperGen extends JvmModelGenerator"?
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Xtext Domainmodel Example
Bundle-Vendor: Eclipse Modeling Project
Bundle-Version: 2.3.0.qualifier
Bundle-SymbolicName: org.eclipse.xtext.example.domainmodel; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.xtext;bundle-version="2.3.0";visibility:=reexport,
org.eclipse.xtext.generator;bundle-version="2.3.0";resolution:=optional;x-installation:=greedy,
org.eclipse.xtend;bundle-version="1.1.0",
org.eclipse.xtend.typesystem.emf;bundle-version="1.0.1",
org.eclipse.xpand;bundle-version="1.1.0",
org.eclipse.xtext.util;bundle-version="2.3.0",
org.eclipse.emf.ecore,
org.eclipse.emf.common,
org.eclipse.emf.mwe2.launch;bundle-version="2.0.0";resolution:=optional;x-installation:=greedy,
org.antlr.runtime;bundle-version="[3.2.0,3.2.1)",
org.eclipse.xtext.xbase;bundle-version="2.3.0",
org.eclipse.xtext.common.types,
org.eclipse.xtext.xbase.lib;bundle-version="2.3.0";visibility:=reexport,
org.eclipse.xtext.ui.codetemplates;bundle-version="2.0.0",
net.sourceforge.plantuml.eclipse;bundle-version="1.1.8"
Export-Package: org.eclipse.xtext.example.domainmodel,
org.eclipse.xtext.example.domainmodel.domainmodel,
org.eclipse.xtext.example.domainmodel.domainmodel.impl,
org.eclipse.xtext.example.domainmodel.domainmodel.util,
org.eclipse.xtext.example.domainmodel.formatting,
org.eclipse.xtext.example.domainmodel.jvmmodel,
org.eclipse.xtext.example.domainmodel.parser.antlr,
org.eclipse.xtext.example.domainmodel.parser.antlr.internal,
org.eclipse.xtext.example.domainmodel.services,
org.eclipse.xtext.example.domainmodel.validation,
org.eclipse.xtext.example.domainmodel.valueconverter,
org.eclipse.xtext.example.domainmodel.serializer
Bundle-ClassPath: lib/plantuml.jar,
.
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: org.apache.log4j,
org.apache.commons.logging
Christian Dietrich wrote on Fri, 12 April 2013 04:03Hi,
i dont know if this came clear; plantuml has nothing todo with xtext.
=> it is a complete "selfmade" solution by you
you have to download plantuml.
(1) for the main include the jar your preferred way
(2)for the adopted generatorthrow it into a lib folder in the domainmdodel project
and edit the manifest e.g
Bundle-ClassPath: lib/plantuml.jar,
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 10:04   |
Eclipse User |
|
|
|
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:54def 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 #1041922 is a reply to message #1041849] |
Mon, 15 April 2013 15:18   |
Eclipse User |
|
|
|
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:00Hi,
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 15:19] by Moderator
|
|
|
|
|
|
|
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 05:06   |
Eclipse User |
|
|
|
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 05:10] by Moderator
|
|
|
|
|
|
|
|
|
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 07:41   |
Eclipse User |
|
|
|
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:

As you might see from the image, the logic is not correct. Could you have some idea?
Attachment: Untitled.png
(Size: 14.02KB, Downloaded 1363 times)
[Updated on: Wed, 17 April 2013 07:44] by 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 06:54   |
Eclipse User |
|
|
|
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 07:02   |
Eclipse User |
|
|
|
Yes, this is my task. Thank you very much for your idea!
Claudio Heeg wrote on Thu, 18 April 2013 06:54Well, 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 04:45   |
Eclipse User |
|
|
|
I think this is the basic idea to draw a correct activity diagram.
Hao Zhang wrote on Thu, 18 April 2013 07:02Yes, this is my task. Thank you very much for your idea!
Claudio Heeg wrote on Thu, 18 April 2013 06:54Well, 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 #1045420 is a reply to message #1045157] |
Sat, 20 April 2013 03:54   |
Eclipse User |
|
|
|
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)
'''--> (*)'''
}
|
|
|
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 04:46   |
Eclipse User |
|
|
|
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:54Sorry 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 06:51] by 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 04:21  |
Eclipse User |
|
|
|
So far as now, the code works perfect. Thank you very much for your contribution!
Christian Dietrich wrote on Sat, 20 April 2013 03:54Sorry 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)
'''--> (*)'''
}
|
|
|