Summary: | Automate required namespace/package user interaction on c++ import | ||
---|---|---|---|
Product: | [Applications] umbrello | Reporter: | Ralf Habacker <ralf.habacker> |
Component: | general | Assignee: | Ralf Habacker <ralf.habacker> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | mark, okellogg |
Priority: | NOR | ||
Version: | 2.13.1 | ||
Target Milestone: | 2.14 (KDE Applications 4.14) | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | http://commits.kde.org/umbrello/a6e8b2e4d6d021b6bb689820d0ae4a3edcee6eb1 | Version Fixed In: | 4.14.1 |
Attachments: |
Hack to prevent manual package/class choose request
c++ test file c++ test case (including all relevant cases) c++ test case (minor syntax fix) c++ test case (add D4) xmi file with affected use cases xmi file with verified use cases |
Description
Ralf Habacker
2014-06-09 19:32:29 UTC
Created attachment 87090 [details]
Hack to prevent manual package/class choose request
The appended patch could be used as a workaround until this features has been implemented. It creates classes by default for all such cases.
Created attachment 87957 [details]
c++ test file
Created attachment 87968 [details]
c++ test case (including all relevant cases)
Here is one proposal how to solve this issue: Initial situation: 1. On importing Bxx classes the related type Dxx is not known, which has currently to be solved by an user action raised through the "namespace or class" dialog. 2. In umbrello code uml class objects and package objects are represented by an UMLClassifier and UMLPackage instance. 3. Class UMLClassifier is derived from UMLPackage. 4. Class widgets are represented by a ClassifierWidget instance and package widgets by a PackageWidget instance. Required changes: 1. On creating unknown type Dxx we need to mark this "class-or-package" condition somewhere in the uml object 2. On importing Class D2 we need to find the already created object with the "class-or-package" flag and retype it to a class. 3. On importing namespace D3 we need to find the already created object with the "class-or-package" flag and retype it to a namespace. 4. After import has been finished there may still be uml objects with the "class-or-package" flag for which a gui action is req (In reply to Ralf Habacker from comment #4) > Here is one proposal how to solve this issue: > > Initial situation: > 1. On importing Bxx classes the related type Dxx is not known, which has > currently to be solved by an user action raised through the "namespace or > class" dialog. > 2. In umbrello code uml class objects and package objects are represented by > an UMLClassifier and UMLPackage instance. > 3. Class UMLClassifier is derived from UMLPackage. > 4. Class widgets are represented by a ClassifierWidget instance and package > widgets by a PackageWidget instance. > > Required changes: > 1. On creating unknown type Dxx we need to mark this "class-or-package" > condition somewhere in the uml object > 2. On importing Class D2 we need to find the already created object with the > "class-or-package" flag and retype it to a class. > 3. On importing namespace D3 we need to find the already created object with > the "class-or-package" flag and retype it to a namespace. > 4. After import has been finished there may still be uml objects with the > "class-or-package" flag for which a gui action is req [sorry for sending not complete comment, I pressed accidently send] uired from the context menu and property dialog to retype the "class-or-package" flagged object to be a real class or package. to discuss: 1. Because class and package widgets uses different classes it may be useful to extend class ClassifierWidget to handle package widgets too, otherwise the ClassifierWidget instance has to be recreated as PackageWidget and reassigned to all parents/childs 2. How to flag "class-or-package" ? Using "class-or-package" as stereotype has the advantage, that such widgets are flagged on diagrams out of the box. Any comment, suggestions or better implementation ? Created attachment 87991 [details]
c++ test case (minor syntax fix)
Created attachment 87992 [details]
c++ test case (add D4)
add namespace D4 to see if icon display in non retyped case works
(In reply to Ralf Habacker from comment #5) > [...] > Required changes: > 1. On creating unknown type Dxx we need to mark this "class-or-package" > condition somewhere in the uml object See also http://bugs.kde.org/79433 : This was done similarly for the former UMLClass, UMLInterface, and UMLDatatype which were dissolved into UMLClassifier, and analogously for {Class,Interface,Datatype}Widget which were dissolved into ClassifierWidget. UMLClassifier enum ClassifierType could be extended by PACKAGE and a corresponding accessor, bool isPackage(). When ClassifierType is ALL (or none of the is{Class,Interface,Datatype,Package} accessors returns true) it means that the actual type was not yet discovered. Dissolving UMLPackage into UMLClassifier would be very heavy weight change, however. Git commit 801d607aa6016340d1fcf3cbfa96353505210f21 by Ralf Habacker. Committed on 25/07/2014 at 11:33. Pushed by habacker into branch 'work/336012'. Automate required namespace/package user interaction on c++ import. If the type of an imported uml object could not be determined the import creates an uml class object and flags the stereotype to be "class-or-package". Such uml objects are displayed in the tree view by a dedicated icon. If the real type of the related uml object is determined later as a class, the flag is removed and the uml object is usable as a generic class. If the real object is a namespace, the flag is removed and the uml object is set to a package type and could be used as regular created package. This is possible because the initial created object of type UMLClassifier is derived from UMLPackage. In the latter case ClassifierWidget paints the object as Package. The tree view and classifier widget context menu has been extended to provide functions to convert a "class or package" uml object to a class or package. Because the "class or package" state is flagged in the stereotype, saving and loading of an umbrello project containing "class or package" flagged uml objects is completly transparent. M +5 -0 umbrello/classifier.cpp M +8 -0 umbrello/codeimport/import_utils.cpp M +28 -6 umbrello/codeimport/kdevcppparser/cpptree2uml.cpp M +2 -0 umbrello/icon_utils.cpp M +1 -0 umbrello/icon_utils.h M +11 -0 umbrello/listpopupmenu.cpp M +1 -0 umbrello/listpopupmenu.h M +1 -1 umbrello/pics/CMakeLists.txt A +- -- umbrello/pics/class-or-package.png A +166 -0 umbrello/pics/sources/class-or-package.svg M +16 -0 umbrello/umllistview.cpp M +7 -0 umbrello/umllistviewitem.cpp M +130 -1 umbrello/widgets/classifierwidget.cpp M +7 -1 umbrello/widgets/classifierwidget.h M +2 -2 umbrello/widgets/widget_factory.cpp http://commits.kde.org/umbrello/801d607aa6016340d1fcf3cbfa96353505210f21 Created attachment 88291 [details]
xmi file with affected use cases
xmi file with affected use cases
Git commit 74741f1629b5a7f7ad1316f378b946cc75e7a466 by Ralf Habacker. Committed on 18/08/2014 at 10:25. Pushed by habacker into branch 'work/336012'. Save imported "class-or-package" uml object, which has been later retyped as package into the xmi file as UMLPackage. On next xmi file load this package is a regular UMLPackage. M +4 -0 umbrello/classifier.cpp http://commits.kde.org/umbrello/74741f1629b5a7f7ad1316f378b946cc75e7a466 Git commit 006ea150fc3b5eed7414014f6dc68b302dcad176 by Ralf Habacker. Committed on 22/08/2014 at 15:44. Pushed by habacker into branch 'work/336012'. Initialize missing class member to avoid crash on destruction. M +2 -1 umbrello/widgets/classifierwidget.cpp http://commits.kde.org/umbrello/006ea150fc3b5eed7414014f6dc68b302dcad176 Git commit 24e75a383d7a166c2fad21bd2eabf6b6de475c5e by Ralf Habacker. Committed on 23/08/2014 at 03:59. Pushed by habacker into branch 'work/336012'. Use 'class-or-package' icon in tree view on loading uml object class with stereotype 'class-or-package'. M +5 -2 umbrello/model_utils.cpp M +1 -1 umbrello/model_utils.h http://commits.kde.org/umbrello/24e75a383d7a166c2fad21bd2eabf6b6de475c5e Git commit 4ad7eb8b102f8653f81494c7648fa2ae1409dd16 by Ralf Habacker. Committed on 23/08/2014 at 04:20. Pushed by habacker into branch 'work/336012'. Use Model_Utils::convert_LVT_IT() for setting tree view icon on uml class objects stereotyped to 'class-or-package'.. M +3 -5 umbrello/umllistviewitem.cpp http://commits.kde.org/umbrello/4ad7eb8b102f8653f81494c7648fa2ae1409dd16 Git commit 45168af373914a10ca33617a8c8b794737cb75a0 by Ralf Habacker. Committed on 23/08/2014 at 04:22. Pushed by habacker into branch 'work/336012'. Automated 'class or package' import support is working now; drop 'class or package' user request. M +0 -16 umbrello/codeimport/import_utils.cpp http://commits.kde.org/umbrello/45168af373914a10ca33617a8c8b794737cb75a0 Created attachment 88382 [details]
xmi file with verified use cases
*** Bug 338634 has been marked as a duplicate of this bug. *** Git commit 1de0459dc7fb87b0dcba82cdd175bd085aba35a3 by Ralf Habacker. Committed on 25/07/2014 at 11:33. Pushed by habacker into branch 'master'. Automate required namespace/package user interaction on c++ import. If the type of an imported uml object could not be determined the import creates an uml class object and flags the stereotype to be "class-or-package". Such uml objects are displayed in the tree view by a dedicated icon. If the real type of the related uml object is determined later as a class, the flag is removed and the uml object is usable as a generic class. If the real object is a namespace, the flag is removed and the uml object is set to a package type and could be used as regular created package. This is possible because the initial created object of type UMLClassifier is derived from UMLPackage. In the latter case ClassifierWidget paints the object as Package. The tree view and classifier widget context menu has been extended to provide functions to convert a "class or package" uml object to a class or package. Because the "class or package" state is flagged in the stereotype, saving and loading of an umbrello project containing "class or package" flagged uml objects is completly transparent. M +5 -0 umbrello/classifier.cpp M +8 -0 umbrello/codeimport/import_utils.cpp M +28 -6 umbrello/codeimport/kdevcppparser/cpptree2uml.cpp M +2 -0 umbrello/icon_utils.cpp M +1 -0 umbrello/icon_utils.h M +11 -0 umbrello/listpopupmenu.cpp M +1 -0 umbrello/listpopupmenu.h M +1 -1 umbrello/pics/CMakeLists.txt A +- -- umbrello/pics/class-or-package.png A +166 -0 umbrello/pics/sources/class-or-package.svg M +16 -0 umbrello/umllistview.cpp M +7 -0 umbrello/umllistviewitem.cpp M +131 -1 umbrello/widgets/classifierwidget.cpp M +7 -1 umbrello/widgets/classifierwidget.h M +2 -2 umbrello/widgets/widget_factory.cpp http://commits.kde.org/umbrello/1de0459dc7fb87b0dcba82cdd175bd085aba35a3 Git commit 4be3031283a7ea43ad6ece4dedb27b30e53ab987 by Ralf Habacker. Committed on 18/08/2014 at 10:25. Pushed by habacker into branch 'master'. Save imported "class-or-package" uml object, which has been later retyped as package into the xmi file as UMLPackage. On next xmi file load this package is a regular UMLPackage. M +4 -0 umbrello/classifier.cpp http://commits.kde.org/umbrello/4be3031283a7ea43ad6ece4dedb27b30e53ab987 Git commit 0a25cc14f633c9c64fa0d069c5b3a860e0c8ba76 by Ralf Habacker. Committed on 23/08/2014 at 03:59. Pushed by habacker into branch 'master'. Use 'class-or-package' icon in tree view on loading uml object class with stereotype 'class-or-package'. M +5 -2 umbrello/model_utils.cpp M +1 -1 umbrello/model_utils.h http://commits.kde.org/umbrello/0a25cc14f633c9c64fa0d069c5b3a860e0c8ba76 Git commit dd6b3bf6437c14dfd9e6afa611fc58e930bb1a5c by Ralf Habacker. Committed on 23/08/2014 at 04:20. Pushed by habacker into branch 'master'. Use Model_Utils::convert_LVT_IT() for setting tree view icon on uml class objects stereotyped to 'class-or-package'.. M +3 -5 umbrello/umllistviewitem.cpp http://commits.kde.org/umbrello/dd6b3bf6437c14dfd9e6afa611fc58e930bb1a5c Git commit a542a080a2da199dde65f68fdc8ebe54eb529dad by Ralf Habacker. Committed on 23/08/2014 at 04:22. Pushed by habacker into branch 'master'. Automated 'class or package' import support is working now; drop 'class or package' user request. M +0 -16 umbrello/codeimport/import_utils.cpp http://commits.kde.org/umbrello/a542a080a2da199dde65f68fdc8ebe54eb529dad Git commit a6e8b2e4d6d021b6bb689820d0ae4a3edcee6eb1 by Ralf Habacker. Committed on 02/09/2014 at 06:21. Pushed by habacker into branch 'KDE/4.14'. Merge remote branch 'origin/work/336012' into KDE/4.14 FIXED-IN:4.14.1 GUI M +5 -2 umbrello/model_utils.cpp http://commits.kde.org/umbrello/a6e8b2e4d6d021b6bb689820d0ae4a3edcee6eb1 Git commit cd350fa7b2c0283331ec15cb784323930511b532 by Ralf Habacker. Committed on 14/09/2015 at 16:13. Pushed by habacker into branch 'Applications/15.08'. Write package widgets into the xmi file using a "packagewidget" tag. This commit is a fixup of commit a6e8b2e4d6d021b6bb689820d0ae4a3edcee6eb1. Thanks to Oliver Kellogg for pointing out. Related: bug 352597 M +7 -1 umbrello/widgets/classifierwidget.cpp M +2 -0 umbrello/widgets/widget_factory.cpp http://commits.kde.org/umbrello/cd350fa7b2c0283331ec15cb784323930511b532 (In reply to Ralf Habacker from comment #18) > Git commit 1de0459dc7fb87b0dcba82cdd175bd085aba35a3 by Ralf Habacker. > Committed on 25/07/2014 at 11:33. > Pushed by habacker into branch 'master'. > > Automate required namespace/package user interaction on c++ import. > [...] > M +28 -6 umbrello/codeimport/kdevcppparser/cpptree2uml.cpp The hunk @@ -84,9 +92,18 @@ contains this code: + else + o = Import_Utils::createUMLObject(UMLObject::ot_Package, nsName, + m_currentNamespace[m_nsCnt], + ast->comment()); and similarly, the hunk @@ -339,9 +356,19 @@ contains this code: + else + o = Import_Utils::createUMLObject(UMLObject::ot_Class, className, + m_currentNamespace[m_nsCnt], + ast->comment(), QString(), true); This is the 'else' part of 'if (!o)'. Out of curiosity: Why do you re-create 'o' although is was returned non NULL? I would have expected to just continue using the existing object. (In reply to Oliver Kellogg from comment #25) > [...] > This is the 'else' part of 'if (!o)'. > Out of curiosity: Why do you re-create 'o' although is was returned non NULL? > I would have expected to just continue using the existing object. Ouch! I misread - 'else' of 'if (!o)' of course means we are in the (o == NULL) case. Sorry for the noise - forget the previous comment, please. Git commit 896cce0d0c8e6b53af190619a94cb9933da9e410 by Ralf Habacker. Committed on 16/12/2015 at 18:15. Pushed by habacker into branch 'frameworks'. Write package widgets into the xmi file using a "packagewidget" tag. This commit is a fixup of commit a6e8b2e4d6d021b6bb689820d0ae4a3edcee6eb1. Thanks to Oliver Kellogg for pointing out. Related: bug 352597 M +7 -1 umbrello/widgets/classifierwidget.cpp M +2 -0 umbrello/widgets/widget_factory.cpp http://commits.kde.org/umbrello/896cce0d0c8e6b53af190619a94cb9933da9e410 Git commit b006b7e76d981824de094c656170140f9ddeb78e by Lays Rodrigues, on behalf of Ralf Habacker. Committed on 27/10/2016 at 11:44. Pushed by laysrodrigues into branch 'frameworks'. Write package widgets into the xmi file using a "packagewidget" tag. This commit is a fixup of commit a6e8b2e4d6d021b6bb689820d0ae4a3edcee6eb1. Thanks to Oliver Kellogg for pointing out. Related: bug 352597 M +1 -1 umbrello/umlwidgets/widget_factory.cpp http://commits.kde.org/umbrello/b006b7e76d981824de094c656170140f9ddeb78e Git commit d273fd556ae1baf2b9735da7046c0ea140eb3df7 by Ralf Habacker. Committed on 12/11/2017 at 21:00. Pushed by habacker into branch 'master'. Fixup of 1de0459dc Limit manual updating of tree view item to "document in loading state" because calling setStereotypeCmd() triggers tree view item update by default if document is not in loading state. M +6 -3 umbrello/codeimport/import_utils.cpp https://commits.kde.org/umbrello/d273fd556ae1baf2b9735da7046c0ea140eb3df7 |