[Uml-devel] kdesdk/umbrello/umbrello/codegenerators

Brian Thomas thomas at mail630.gsfc.nasa.gov
Tue Apr 13 13:10:02 UTC 2004


CVS commit by thomas: 

bug fix: java code classifier gen was making import statements for the default 'datatypes'. THis is wrong.. java doesnt need to do this, so I created this hack to prevent all datatypes from showing up in the import section. THis is not the final fix, however, as a user *may* create their own datatype in the future and want that to appear..not sure if this is legit or not


  M +5 -3      javaclassifiercodedocument.cpp   1.24


--- kdesdk/umbrello/umbrello/codegenerators/javaclassifiercodedocument.cpp  #1.23:1.24
@@ -33,4 +33,5 @@
 #include "javacodeaccessormethod.h"
 #include "javacodeoperation.h"
+#include "../datatype.h"
 
 // Constructors/Destructors
@@ -260,5 +261,4 @@ void JavaClassifierCodeDocument::loadChi
                                         QString id = element.attribute("parent_id","-1");
                                         UMLObject * obj = getParentGenerator()->getDocument()->findUMLObject(id.toInt());
-if(!obj) kdError()<<" CANT FIND PARENT OP FOR ID:"<<id<<endl;
                                         UMLOperation * op = dynamic_cast<UMLOperation*>(obj);
                                         if(op) {
@@ -373,5 +373,4 @@ void JavaClassifierCodeDocument::updateC
         UMLClassifier * c = getParentClassifier();
         CodeGenerator * g = getParentGenerator();
-        // JavaCodeGenerator * gen = dynamic_cast<JavaCodeGenerator*>(g);
         JavaCodeGenerator * gen = (JavaCodeGenerator*)g;
 
@@ -424,5 +423,8 @@ void JavaClassifierCodeDocument::updateC
         gen->findObjectsRelated(c,imports);
         for(UMLClassifier *con = imports.first(); con ; con = imports.next())
-                if (!(packageMap->contains(con)))
+                // NO (default) datatypes in the import statement.. use defined
+                // ones whould be possible, but no idea how to do that...at least for now.
+                // Dynamic casting is slow..not an optimal way to do this.
+                if (!(packageMap->contains(con)) && !(dynamic_cast<UMLDatatype*>(con)))
                 {
                         packageMap->insert(con,con->getPackage());






More information about the umbrello-devel mailing list