Mix classes and use cases in PlantUML diagram - plantuml

I try to create a diagram which contains the class hierarchy as well as use cases which use the classes. I tried to use PlantUML today, but somehow one cannot mix these two diagram types. This is the simplest file I could come up with:
#startuml
class Foo
usecase Bar
#enduml
When I only have one of these lines in there, it works fine. But with both lines I get this:
❯ plantuml text.txt
Error line 5 in file: text.txt
Some diagram description contains errors
Is there some way to put both into the diagram, or is that just impossible?

I had used PlantUML 1.2021.0. This apparently doesn't contain the allowmixing feature, that the current version 1.2021.14 supports. Upgrading the software and adding allowmixing to the file cures this problem.
#startuml
allowmixing
class Foo
usecase Bar
#enduml

Related

PlantUML: How to change diagram style

for a while I'm using PlantUML to create sequence diagram.
Everything works fine ... but looked a bit boring and "geek"-like.
So I google for nice sprites and found PlantUML Icon-Font Sprites on GitHub.
I included the sprites successfully in my sequence diagram but as soon as I used them, I got a syntax error.
After some investigation, I discovered that PlantUML tries to create state diagrams and certain elements of the sequence diagram (like the separator) are not valid.
So my two questions:
How does PlantUML decide which diagram type to draw?
How can I change this to sequence diagrams?
Example
#startuml
!pragma teoz true
skinparam defaultTextAlignment center
!include puml-icons/common.puml
!include puml-icons/font-awesome-5/user.puml
hide footbox
/'FA5_USER(Alice, Alice)
FA5_USER(Bob, Bob)'/
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
#enduml
#startuml
!pragma teoz true
skinparam defaultTextAlignment center
!include puml-icons/common.puml
!include puml-icons/font-awesome-5/user.puml
hide footbox
FA5_USER(Alice, Alice)
FA5_USER(Bob, Bob)
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
#enduml
See How can a PlantUML document specify its diagram type?
And Examples on https://plantuml.com/commons that gives an idea how PlantUML decides what diagram to generate.
You can use hidden elements of specific type, like component for deployment diagram, to point PlantUML into right direct, when there is mix.

DMN Decision Table Output

I am new to decision table so please forgive me if I asked a very basic question. I am working on an angular web app that uses decision table.
Could we change the table header 'Output' to something else?
Unfortunately, I cannot find any such label neither in the HTML nor in the controller.
For future reference:
It cannot be done through CSS. therefore following is my solution.
Inspect the code that either the dmn table is using modeling module or some other bpmn table features. In my case, it is using modeling. I override the following module by inheriting from it, to make the Input header cell dynamic and output fixed or change the label as well.
https://github.com/bpmn-io/dmn-js/blob/31803afe1bdccdc350da73293a75e2cbf3f14932/lib/table/features/modeling/Modeling.js

Is it possible to use custom images for UML items in plantUML?

PlantUML is very powerful when you would like to create standard UML diagrams.
But I currently think about using PlantUML to document EIP routes (like the routes on these images: https://www.google.de/search?q=camel+route&safe=off&source=lnms&tbm=isch).
This would be pretty easy if you could specify another image instead of normal boxes for a class. Something like an SVG or WMF image or a shape script as in Sparx Enterprise Architect.
The only custom images I found in the documentation where those tiny sprites...
From PlantUML's Language Reference Guide
11.6 Legacy HTML
Some HTML tags are also working:
<img:file> : the file must be accessible by the filesystem
<img:http://url> : the URL must be available from the Internet
It appears that it shouldn't be a problem. There is also a PlantUML Word Plug-in, that would possibly enable you to paste images over the default ones otherwise.
The following PlantUML code renders a simple diagram - the referenced images have to be in the proper location...
object "inbound message" as m1
object "XML Splitter" as s1
m1 : <img:MessageIcon.gif>
s1 : <img:SplitterIcon.gif>
m2 : <img:MessageIcon.gif>
m1 -> s1
s1 -> m2
plantuml-icon-font-sprites allows using font-awesome icons within plantuml. It's awesome!
If you are building a diagram include allow_mixing at the top of the code.

Best configuration and parameters for ctags in a CakePHP project

What is the best configuration and parameters for ctags in a CakePHP project?
I want to be able to auto-complete ctp files, Components, Behaviours, Models and Helpers?
Check these github repositories, I have found then and they are so good for work with php and cakephp
https://github.com/amix/vimrc
https://github.com/ndreynolds/vim-cakephp
This solution requires 1 line in your .ctags file and two lines in your .vimrc file, so it's fairly minimal.
tl;dr
.ctags:
--langmap=php:+.ctp
.vimrc:
# Controller -> Component
map <leader>t yiw<cr>:tag /^<C-R>"<CR>
# View -> Helper
map <leader>h yiw<cr>:tag /^<C-R>"Helper<CR>
Add Views to your tags
This solution is mostly for jumping between files. I'll try and add auto-completion at a later date.
Add this to your ~/.ctags options file to include CakePHP views as PHP files:
--langmap=php:+.ctp
Then I'm assuming you've done ctags -R . at the root of your project (that's what I've done at least). This out of the box should pick up PHP syntax and class definitions.
Auto-completion (general)
I found the auto-completion (omni-completion from Ctrl+XCtrl+O) doesn't work very nicely with PHP, e.g. if I type $this-> and then try to auto-complete it doesn't find any tags.
The fix for this was to use install phpcomplete.vim. This will find methods within your class.
However that won't auto-complete connected models.
Models
By default ctags should work for all Controller -> Model jumping as the Model name is the same as the class name.
Behaviors
These again should be fine as you don't specify the name of the behavior you just have the method name which depending on how independent the name is it should get found - or at least it will be in the list of tags.
Components
There's no direct way of mapping these, I couldn't see a way of mapping them through the ctags --regex options. ctags recognises that they are classes but doesn't know the xxx -> xxxComponent mapping.
However there is one slight trick. You can do a tag search on the beginning of the class name (source)
:tag /^Email
will find
class EmailComponent
You can then map this in your .vimrc
map <leader>t yiw<cr>:tag /^<C-R>"<CR>
This copies the word that you've got the cursor over and then pastes it into the tag command and executes it. My leader is set to ,, so I can type ,t and it takes me to the corresponding component under the cursor.
Helpers
Ok, another slight hack in the .vimrc file:
map <leader>h yiw<cr>:tag /^<C-R>"Helper<CR>
Using ,h, this will jump you from $html->... to
class HtmlHelper extends AppHelper {
But it doesn't work for functions inside e.g. if your cursor is over script in $html->script, it will not take you to the HtmlHelper script method. So it's a work in progress.

Can Not Refactor Class Name in XCode

I am trying to rename the class name for a view controller (which has an associated .xib file) via XCode's refactoring tool. After entering a new name, I get this error message (no preview of changes):
The selection is not a type that can be renamed.
Make a different selection and try again.
I have tried all the suggestions in this SO thread, but no luck.
What could prevent XCode from being able to refactor a class (and related file names), when other classes and variables can be refactored without any problem?
I think you tried to change the classname by selecting the file and press refactor or you select it in the #import "classname".
Instead try to select "classname" in the interface definition after #interface
I also met this problem
Here is my solution
Move the whole Project to another place Then it works(to me)

Resources