Possibility of showing all diagrams in an editor/file
hallvard opened this issue · 16 comments
Currently, the diagram shown in the view is based on the editor cursor position (in general how the diagram provider uses the editor's state, typically the cursor/selection). You can have several diagrams in your editor, but only one is shown at a time. We should consider showing all the diagrams in an editor at once, and select the tab based on the cursor/selection. Perhaps you could even navigate in the editor when selecting a tab. Technically, we could reuse the tabbed design used with multi-page diagrams, perhaps even generate one large diagram from all diagrams with newpage commands in between.
Tabs get unusable when number of diagrams it to big, like 10-20
that is easy to get in a list of diagrams
https://github.com/de-jcup/eclipse-asciidoctor-editor/blob/master/asciidoctor-editor-other/testscripts/21_diagrams_plantuml_only.adoc
In that case it would be nice to have a clickable list.
There is problem though for any case that diagram do not have title,
so when there are many of them, just referencing to them is problematic.
... So simple numbering would help.
A clickable (drop down) list makes sense. A "title" could be generated from the first line in the diagram source.
Hello Sir,
Currently, eclipse plugin can display multiple diagrams in pages when diagrams are separated using "newpage" keyword. Please refer to the below example.
@startuml
a->b: hello;
newpage newpagetitle
b->a : back on new page;
@enduml;
But when tried to export all the diagrams, only the first page would get displayed.
So, I modified these instructions as below to display multiple pages when exported.
@startuml
a->b: hello;
@enduml
@startuml
b->a : back on new page;
@enduml
But when opened in eclipse, plugin would display the diagram that has the cursor focus.
So having clickable list is better idea.
Do you have some plan to release eclipse plugin with these features integrated?
No plans, yet.
In your comment you seemed to suggest the need for exporting all diagrams at once, instead of one at a time (be switching to each tab and exporting)?
Yes, I mean to say, When using "newpage" for separating the diagrams, the diagrams gets exported to multiple tabs. But when using multiple @startuml and @endumls, only the first diagram would be exported.
It would be better idea to have either clickable list (as explained by you in few above comments) or multiple tabs. Number of tabs depend on the number of @startuml & @enduml loops in the plantUML source.
Please suggest if any other alternatives to export all the diagrams at once. (I am very much restricted in using "newpage" as it exports only one diagram.)
OK, so "exported" in this case doesn't refer to the export (to png or svg) menu action.
My current thought about selecting in a list is to generate the list from the editor contents (@startuml-@enduml tags), but delay generation of the diagram till you select an item. Selecting an item corresponds to moving the cursor to a @startuml tag, which will trigger diagram generation.
Hello Sir,
Thanks for supporting this feature in eclipse plugin. This feature really helps up.
May I know when we can expect the next release?
Thank you,
I've just released a new version where the view menu lists the explicit diagrams in a file. When one is selected, the corresponding diagram is shown. Please try it out and give feedback!
I've files with two @startuml - @enduml sections, but do not see any dropdown menu.
Versions:
PlantUML Feature 1.1.22
PlantUML Library Feature 1.2019.0
Eclipse IDE for C/C++ Developers
Version: 2018-12 (4.10.0)
Build id: 20181214-0600
example file e.g. "rle_test.puml":
@startuml
digraph component_graph {
"cpu1500::rle_test" [color=black,fillcolor=lightgrey,penwidth=1.00,style="filled"]
"cpu1500::rle_test" -> "base::googletest" [color=black,fillcolor=black,penwidth=1.00,style="filled"]
"base::googletest" [color=black,fillcolor=white,penwidth=1.50,style="filled,filled"]
}
@enduml
@startuml
digraph legende_graph {
rankdir=LR
subgraph cluster01 {
label = "Legend"
first [color=black,fillcolor=lightgrey,penwidth=1.00,style="filled"]
pred [color=black,fillcolor=white,penwidth=1.50,style="filled"]
"first node" [shape=plaintext]
"direct predecessor" [shape=plaintext]
first -> "first node" [style=invis]
pred -> "direct predecessor" [style=invis]
user -> used [color=black,fillcolor=black,penwidth=1.00,style="filled"]
transitive -> used [color=black,fillcolor=black,penwidth=1.00,style="dashed"]
friend -> used [color=black,fillcolor=black,penwidth=1.50,style="filled"]
tester -> used [color=black,fillcolor=black,penwidth=2.50,style="filled"]
}
}
@enduml
The view is refreshed if cursor is placed in editor in one of the diagram sections only:
The issue is still there, so it does not work always...
I think there's a problem with the menu's life-cycle. It is populated lazily, when it is opened, but sometimes it isn't shown at all, and then it will not be populated either, since it cannot be triggered by the end-user. I'm considering moving it to a button, to make the feature more visible and have more control.
Thanks for checking it out!
Keyboard shortcuts for jump to or cycle through diagrams woould be nice ;)