[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Mon May 1 08:46:05 UTC 2006


SVN commit 536181 by okellogg:

fix for commit 536092

 M  +2 -2      textblock.cpp  
 M  +8 -4      uml.cpp  
 M  +5 -0      uml.h  
 M  +2 -6      umldoc.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/textblock.cpp #536180:536181
@@ -140,12 +140,12 @@
 }
 
 QString TextBlock::getNewLineEndingChars ( ) {
-    CodeGenerationPolicy * policy = UMLApp::app()->getGenerator()->getPolicy ( );
+    CodeGenerationPolicy * policy = UMLApp::app()->getDefaultPolicy();
     return policy->getNewLineEndingChars();
 }
 
 QString TextBlock::getIndentation() {
-    CodeGenerationPolicy * policy = UMLApp::app()->getGenerator()->getPolicy ( );
+    CodeGenerationPolicy * policy = UMLApp::app()->getDefaultPolicy();
     return policy->getIndentation();
 }
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/uml.cpp #536180:536181
@@ -1197,17 +1197,21 @@
     m_refactoringAssist->show();
 }
 
+CodeGenerationPolicy *UMLApp::getDefaultPolicy() {
+    return m_defaultcodegenerationpolicy;
+}
+
 CodeGenerator *UMLApp::setGenerator(Uml::Programming_Language pl) {
-    // does the code generator for our activeLanguage already exist?
+    // does the code generator already exist?
     // then simply return that
     CodeGenerator *g = getDocument()->findCodeGeneratorByLanguage(pl);
-    if(g) {
+    if (g) {
+        getDocument()->setCurrentCodeGenerator(g);
         return g;
     }
 
     g = CodeGenFactory::createObject(pl);
-    if (getDocument()->getCurrentCodeGenerator() == NULL)
-        getDocument()->setCurrentCodeGenerator(g);
+    getDocument()->setCurrentCodeGenerator(g);
 
     // now set defaults on the new policy from the configuration
     // file and THEN the default policy, which may have been updated
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/uml.h #536180:536181
@@ -306,6 +306,11 @@
      */
     QString getStatusBarMsg();
 
+    /**
+     * Returns the default code generation policy.
+     */
+    CodeGenerationPolicy *getDefaultPolicy();
+
 protected:
     virtual void keyPressEvent(QKeyEvent* e);
     virtual void keyReleaseEvent(QKeyEvent* e);
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umldoc.cpp #536180:536181
@@ -254,6 +254,7 @@
     // remove all code generators
     for (CodeGeneratorListIt it(m_codeGenerators); it.current(); ++it)
         removeCodeGenerator(it.current());
+    m_codeGenerators.clear();
 
     m_currentcodegenerator = 0;
 
@@ -1141,7 +1142,7 @@
             temp->setID( getUniqueID() );
             addView(temp);
             emit sigDiagramCreated( EXTERNALIZE_ID(m_uniqueID) );
-            setModified(true);
+            setModified(true, false);
             UMLApp::app()->enablePrint(true);
             changeCurrentView( EXTERNALIZE_ID(m_uniqueID) );
             break;
@@ -2072,11 +2073,6 @@
             m_codeGenerationXMIParamMap->insert(lang, cgelement);
             Uml::Programming_Language pl = Model_Utils::stringToProgLang(lang);
             CodeGenerator *g = UMLApp::app()->setGenerator(pl);
-            if (g == NULL) {
-                g = CodeGenFactory::createObject(pl);
-                if (getCurrentCodeGenerator() == NULL)
-                    setCurrentCodeGenerator(g);
-            }
             g->loadFromXMI(cgelement);
             cgnode = cgnode.nextSibling();
             cgelement = cgnode.toElement();




More information about the umbrello-devel mailing list