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

Oliver Kellogg okellogg at users.sourceforge.net
Sun Aug 6 19:59:42 UTC 2006


SVN commit 570457 by okellogg:

Attachment 17246 from JP Fournier adds logic to keep track of files already
parsed to avoid gratuitous reparsing.
JP, I've added you as co-author to the javaimport.h, hope that's okay :)
BUG:131961


 M  +1 -0      ChangeLog  
 M  +12 -5     umbrello/codeimport/javaimport.cpp  
 M  +13 -0     umbrello/codeimport/javaimport.h  


--- branches/KDE/3.5/kdesdk/umbrello/ChangeLog #570456:570457
@@ -5,6 +5,7 @@
   instead of public (131327)
 * Python code generation not independent of diagram view (131790)
 * Java import - method parameter types not resolved correctly (131825)
+* Java import: unable to import AzareusCore (131961)
 
 Version 1.5.4
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codeimport/javaimport.cpp #570456:570457
@@ -38,6 +38,7 @@
 }
 
 void JavaImport::initVars() {
+    m_parseDepth = 0;
     m_isStatic = false;
 }
 
@@ -130,19 +131,18 @@
 
 ///Spawn off an import of the specifed file
 void JavaImport::spawnImport( QString file ) {
-    static QStringList filesBeingParsed;
     // if the file is being parsed, don't bother
     //
-    if (filesBeingParsed.contains( file ) ) {
+    if (m_filesAlreadyParsed.contains( file ) ) {
         return;
     }
     if (QFile::exists(file)) {
           JavaImport importer;
           QStringList fileList;
           fileList.append( file );
-          filesBeingParsed.append( file );
+          m_filesAlreadyParsed.append( file );
           importer.importFiles( fileList ); 
-          filesBeingParsed.remove( file );
+
     }
 }
 
@@ -233,8 +233,15 @@
     // public for member vars and methods
     m_defaultCurrentAccess = Uml::Visibility::Implementation;
     m_currentAccess = m_defaultCurrentAccess;
-
+    m_parseDepth++;
     NativeImportBase::parseFile(filename);
+    m_parseDepth--;
+    if ( m_parseDepth <= 0 ) {
+        // if the user decides to clear things out and reparse, we need
+        // to honour the request, so reset things for next time.
+        m_filesAlreadyParsed.clear();
+        m_parseDepth = 0;
+    }
 }
 
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codeimport/javaimport.h #570456:570457
@@ -18,6 +18,7 @@
 /**
  * Java code import
  * @author Oliver Kellogg
+ * @author JP Fournier
  * Bugs and comments to uml-devel at lists.sf.net or http://bugs.kde.org
  */
 class JavaImport : public NativeImportBase {
@@ -86,6 +87,18 @@
     QStringList m_imports;
 
     /**
+     * Keep track of the files we have already parsed so we don't
+     * reparse the same ones over and over again.
+     */
+    QStringList m_filesAlreadyParsed;
+
+    /**
+     * Keep track of the parses so that the filesAlreadyParsed 
+     * can be reset when we're done.
+     */
+    int m_parseDepth;
+
+    /**
      * The current visibility for when the visibility is absent
      */
     Uml::Visibility m_defaultCurrentAccess;




More information about the umbrello-devel mailing list