Version: 1.2.90 (using KDE 3.2.1, (testing/unstable)) Compiler: gcc version 3.3.3 (Debian) OS: Linux (i686) release 2.4.24-xfs With "53361 update code import code" closed for C++ it would be nice to be able to import all the other langauges that KDevelop has parsers for.
In order to do this, it would probably be a good idea to use the CodeModel and CodeModelTreeParser (see kdevelop/ lib/interfaces.) That way, the parsers could remain mostly unchanged, and we avoid having to work with different language specific tree representations. Added benefit: This moves us closer to Kdevelop.
*** Bug 92201 has been marked as a duplicate of this bug. ***
I see that umbrello is already using the treeparser class from kdevelop as the base class for parsing C++. In umbrello, the derived class is called cpptree2uml as opposed to store_walker in kdevelop. However, it seems that only the C++ import feature uses that, while the parsers for other languages are done some other way. I found the codemodel_treeparser in kdevelop source, but I can't find any other classes that use it. I was curious to see how Python is handled in Kdevelop, to see if I could at least add python support to umbrello. However, I can't find any C++ classes related to python that use the codemodel_treeparser. There is a kde_inspect.py class which seems to permit some kind of introspection for python. I am not sure how that fits into the big picture though.
> However, it seems that only the C++ import feature uses that > [i.e. code model tree parser] > while the parsers for other languages are done some other way. I presume this is a TODO in Kdevelop. Alex, could you comment?
Just in time for 1.4, we have code import for CORBA IDL. Still very simple and does not yet use the Kdevelop CodeModel. IDL import is enabled by selecting IDL as the active language.
SVN commit 445642 by okellogg: CCBUG:79648 - Add AdaImport. Still work in progress. M +1 -0 Makefile.am A adaimport.cpp [License: GPL (v2+)] A adaimport.h [License: GPL (v2+)] M +2 -1 uml.cpp --- branches/KDE/3.5/kdesdk/umbrello/umbrello/Makefile.am #445641:445642 @@ -4,6 +4,7 @@ umbrello_SOURCES = activitywidget.cpp \ actor.cpp \ actorwidget.cpp \ +adaimport.cpp \ aligntoolbar.cpp \ artifact.cpp \ artifactwidget.cpp \ --- branches/KDE/3.5/kdesdk/umbrello/umbrello/uml.cpp #445641:445642 @@ -50,6 +50,7 @@ #include "infowidget.h" #include "cppimport.h" #include "idlimport.h" +#include "adaimport.h" #include "docwindow.h" #include "codegenerator.h" #include "generatorinfo.h" @@ -1415,7 +1416,7 @@ if (firstFile.endsWith(".idl")) classImporter = new IDLImport(); else if (firstFile.contains( QRegExp("\\.ad[sba]$") )) - /* classImporter = new AdaImport(); */; + classImporter = new AdaImport(); else classImporter = new CppImport(); // the default. classImporter->importFiles(fileList);
that could be nice if we could import java code... and umbrello generate the class diagram
SVN commit 492999 by okellogg: Add Java code import (still work in progress.) M +1 -0 Makefile.am AM javaimport.cpp [License: GPL (v2+)] AM javaimport.h [License: GPL (v2+)] M +5 -0 uml.cpp
> ------- Additional Comment #3 From Alan Ezust 2005-01-23 06:52 ------- > [...] > However, it seems that only the C++ import feature uses that > [i.e. code model tree parser] > while the parsers for other languages are done some other way. Currently those are hand written scanners. They are not even "parsers" because no syntax tree is constructed. That is possible because Umbrello uses only a fraction of the entire grammar of a given language, only (a subset of) the declarative statements.
SVN commit 495324 by okellogg: Add class PythonImport. Only imports classes and operations, no attributes yet. Python people to the front ;) CCBUG:79648 M +2 -0 Makefile.am A classimport.cpp [License: no copyright GPL (v2+)] M +5 -0 classimport.h M +2 -2 import_utils.cpp A pythonimport.cpp [License: GPL (v2+)] A pythonimport.h [License: GPL (v2+)] --- branches/KDE/3.5/kdesdk/umbrello/umbrello/Makefile.am #495323:495324 @@ -17,6 +17,7 @@ classifiercodedocument.cpp \ classifierlistitem.cpp \ classifierwidget.cpp \ +classimport.cpp \ codeaccessormethod.cpp \ codeblock.cpp \ codeblockwithcomments.cpp \ @@ -73,6 +74,7 @@ packagewidget.cpp \ plugin.cpp \ pluginloader.cpp \ +pythonimport.cpp \ seqlinewidget.cpp \ statewidget.cpp \ stereotype.cpp \ --- branches/KDE/3.5/kdesdk/umbrello/umbrello/classimport.h #495323:495324 @@ -36,6 +36,11 @@ */ virtual void importFiles(QStringList files) = 0; + /** + * Factory method. + */ + static ClassImport *createImporterByFileExt(QString filename); + }; #endif --- branches/KDE/3.5/kdesdk/umbrello/umbrello/import_utils.cpp #495323:495324 @@ -118,10 +118,10 @@ int isConst = name.contains(QRegExp("^const ")); name.remove(QRegExp("^const\\s+")); QString typeName(name); - const int isAdorned = typeName.contains( QRegExp("[^\\w: ]") ); + const int isAdorned = typeName.contains( QRegExp("[^\\w:\\. ]") ); const int isPointer = typeName.contains('*'); const int isRef = typeName.contains('&'); - typeName.remove(QRegExp("[^\\w: ].*$")); + typeName.remove(QRegExp("[^\\w:\\. ].*$")); UMLObject *origType = umldoc->findUMLObject(typeName, Uml::ot_UMLObject, parentPkg); if (origType == NULL) { // Still not found. Create the stripped down type.
At this point I'm not sure how much sense this would make.
*** This bug has been marked as a duplicate of 56943 ***