Hi,
It seems that the bug and patches trackers at
http://gforge.enseeiht.fr/projects/uml2java don't work.
I posted a bug declaration 10 days ago, and comming back today, I don't see
anything anymore.
I switched from Netbeans to Eclipse + Topcased for my UML courses in last
septembre because Oracle don't support the UML Netbeans plugin anymore.
I find Topcased very fine but the UML to Java translation has many bugs that
are difficult to deal with, specially for teaching.
I spent some time for patching during the last days, but where can I submit
them ?
Here are the 2 first ones.
Bug#1
There is a bug in the computation of the log path for the Java generation.
For a model file "mymodel.uml" and a target directory "/target", the
computed path is "/targetmymodel.log.txt" insteed of
"/target/mymodel.log.txt".
Patch (Java2Uml.logpath.Patch.txt)
Add the missing "/" in
org.topcased.uml2java.launcher::org/topcased/uml2java/GenJava.java
Bug#2
a- The right clic menu on the .uml model file don't launch the topcased
uml2java.mt template, but the java.mnt Acceleo one.
b- The generation parameters (properties) from the model preferences are not
read when the topcased uml2java.mt template is used directly in a
user chain or from an Acceleo reflexive editor (useful for accessing model
elements and generating only a part of a model).
Patches (Uml2JavaLauching-generatorPatch.txt and
Uml2JavaLauching-launcherPatch.txt)
For part a
1- In org.topcased.uml2java.generator::/Acceleo :
introduce a new default chain.
2- In
org.topcased.uml2java.launcher::/src/org/topcased/uml2java/GenJava.java :
replace the chainPath
"org.acceleo.module.pim.uml21.gen.java/chain/java.chain")
by "org.topcased.uml2java.generator/Acceleo/default.chain".
For part b
1- In
org.topcased.uml2java.generator::/src/org/topcased/uml2java/utilities/Configuration.java
:
add a method setConfigurationFile to be called from the uml2java.mt template
file for giving the path of the model file.
2_ In org.topcased.uml2java.generator::/Acceleo/uml2java.mt
introduce at the end of this template a new script
setConfigurationParameters to be triggered at the beginning of the model
parsing
(reading the root "Model" node), that call the new
Configuration.setConfigurationFile method.
Jean-Pierre PECUCHET
INSA Rouen
### Eclipse Workspace Patch 1.0
#P org.topcased.uml2java.launcher
Index: src/org/topcased/uml2java/GenJava.java
===================================================================
RCS file:
/cvsroot/uml2java/plugins/org.topcased.uml2java.launcher/src/org/topcased/uml2java/GenJava.java,v
retrieving revision 1.4
diff -u -r1.4 GenJava.java
--- src/org/topcased/uml2java/GenJava.java 16 Sep 2009 16:35:50 -0000
1.4
+++ src/org/topcased/uml2java/GenJava.java 2 Jan 2011 07:44:55 -0000
@@ -135,7 +135,7 @@
//Log
Log log = ChainFactory.eINSTANCE.createLog();
EFactory.eAdd(repository,"files",log);
- EFactory.eSet(log,"path",output +
modelPath.removeFileExtension().lastSegment() + ".log.txt");
+ EFactory.eSet(log,"path",output + "/" +
modelPath.removeFileExtension().lastSegment() + ".log.txt");
//Retrieve TMP file
IPath tmpPath;
### Eclipse Workspace Patch 1.0
#P org.topcased.uml2java.generator
Index: Acceleo/default.chain
===================================================================
RCS file: Acceleo/default.chain
diff -N Acceleo/default.chain
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Acceleo/default.chain 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="ASCII"?>
+<chain:Chain xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:chain="http://www.obeo.fr/acceleo/chain"
parametersFiles="//@repository/@files.0 //@repository/@files.1
//@repository/@files.2">
+ <repository>
+ <files xsi:type="chain:Model" path="<%model%>"/>
+ <files xsi:type="chain:Folder" path="<%src%>"/>
+ <files xsi:type="chain:Log" path="<%error.log%>"/>
+ <files xsi:type="chain:EmfMetamodel"
path="http://www.eclipse.org/uml2/3.0.0/UML"/>
+ <files xsi:type="chain:Generator"
path="org.topcased.uml2java.generator/Acceleo/uml2java.mt"/>
+ </repository>
+ <actions>
+ <actions xsi:type="chain:Generate" documentation="org.topcased.uml2java"
log="//@repository/@files.2" model="//@repository/@files.0"
metamodel="//@repository/@files.3" generator="//@repository/@files.4"
folder="//@repository/@files.1"/>
+ </actions>
+</chain:Chain>
Index: Acceleo/uml2java.mt
===================================================================
RCS file:
/cvsroot/uml2java/plugins/org.topcased.uml2java.generator/Acceleo/uml2java.mt,v
retrieving revision 1.3
diff -u -r1.3 uml2java.mt
--- Acceleo/uml2java.mt 22 Jun 2009 09:44:00 -0000 1.3
+++ Acceleo/uml2java.mt 2 Jan 2011 07:35:57 -0000
@@ -439,3 +439,8 @@
<%}%>
public enum <%name%>{<%ownedLiteral.name.sep(", ")%>};<%clearAssociations()%>
<%}%>
+<%-- Set the configuration parameters from the Model file --%>
+<%script type="uml.Model" name="setConfigurationParameters"%>
+<%setConfigurationFile(eResource())%>
+<%script type="uml.Model" name="default" file="_tmp"%>
+<%setConfigurationParameters%>
Index: src/org/topcased/uml2java/utilities/Configuration.java
===================================================================
RCS file:
/cvsroot/uml2java/plugins/org.topcased.uml2java.generator/src/org/topcased/uml2java/utilities/Configuration.java,v
retrieving revision 1.2
diff -u -r1.2 Configuration.java
--- src/org/topcased/uml2java/utilities/Configuration.java 14 Sep 2007
09:09:37 -0000 1.2
+++ src/org/topcased/uml2java/utilities/Configuration.java 2 Jan 2011
07:35:57 -0000
@@ -16,6 +16,10 @@
import org.eclipse.core.runtime.QualifiedName;
import org.topcased.uml2java.GenJava;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
/**
* Configuration utilities
* @author Ariel RAMPHUL (Sopra Group - Toulouse)
@@ -26,6 +30,7 @@
private static Hashtable<String,String> config = new
Hashtable<String,String>();
private static boolean initialized = false;
private static String header;
+ private static boolean parameterized = false;
/**
* Return the value of a key
@@ -263,21 +268,30 @@
}
/**
- * Load the configuration settings from the selected model (in the Package
Explorer of Eclipse)
+ * Load the configuration settings
*/
private static void initConfig()
{
IFile file = GenJava.getModel();
- String s;
-
- if (file == null)
+
+ if (file == null && !parameterized)
{
//if we are here, it means that the UML2JAVA.LAUNCHER wasn't
initialized :(
loadDefaultConfig();
loadDefaultHeader();
}
- else
+ else if (file != null)
{
+ loadFileConfig(file);
+ }
+ }
+
+ /**
+ * Load the configuration settings from the selected model (in the Package
Explorer of Eclipse)
+ */
+ private static void loadFileConfig(IFile file)
+ {
+ String s;
try
{
s = file.getPersistentProperty(new QualifiedName("",
"GEN_AUTHOR"));
@@ -326,6 +340,23 @@
}
}
+
+ /**
+ * Set the model file from which to get the configuration parameters.
Called by the template file
+ * when used directly from an Acceleo chain or reflective editor.
+ */
+ public void setConfigurationFile(org.eclipse.uml2.uml.Model m, String
projectRelativePath)
+ {
+ IPath projectPath =
ResourcesPlugin.getWorkspace().getRoot().getLocation();
+ IPath prp = new Path(projectRelativePath);
+ IPath path = projectPath.append(prp.removeFirstSegments(1));
+ IFile file =
ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new
Path(path.toOSString()));
+
+ if (file != null)
+ {
+ loadFileConfig(file);
+ parameterized = true;
+ }
}
}
### Eclipse Workspace Patch 1.0
#P org.topcased.uml2java.launcher
Index: src/org/topcased/uml2java/GenJava.java
===================================================================
RCS file:
/cvsroot/uml2java/plugins/org.topcased.uml2java.launcher/src/org/topcased/uml2java/GenJava.java,v
retrieving revision 1.4
diff -u -r1.4 GenJava.java
--- src/org/topcased/uml2java/GenJava.java 16 Sep 2009 16:35:50 -0000
1.4
+++ src/org/topcased/uml2java/GenJava.java 2 Jan 2011 07:31:45 -0000
@@ -135,7 +135,7 @@
//Log
Log log = ChainFactory.eINSTANCE.createLog();
EFactory.eAdd(repository,"files",log);
- EFactory.eSet(log,"path",output +
modelPath.removeFileExtension().lastSegment() + ".log.txt");
+ EFactory.eSet(log,"path",output + "/" +
modelPath.removeFileExtension().lastSegment() + ".log.txt");
//Retrieve TMP file
IPath tmpPath;
@@ -147,7 +147,7 @@
//chain call actions
ChainCall callAction = ChainFactory.eINSTANCE.createChainCall();
EFactory.eAdd(actionSet,"actions",callAction);
- EFactory.eSet(callAction, "chainPath",
"org.acceleo.module.pim.uml21.gen.java/chain/java.chain");
+ EFactory.eSet(callAction, "chainPath",
"org.topcased.uml2java.generator/Acceleo/default.chain");
EFactory.eSet(callAction,"documentation","org.topcased.uml2java");
EFactory.eAdd(callAction, "argumentsFiles", model);
EFactory.eAdd(callAction, "argumentsFiles", folder);
_______________________________________________
Topcased-users mailing list
[email protected]
http://lists.gforge.enseeiht.fr/mailman/listinfo/topcased-users