RFR: JDK-8290063: IGV: Give the graphs a unique number in the outline [v2]
Tobias Holenstein
tholenstein at openjdk.org
Wed Nov 2 09:26:44 UTC 2022
> Some graphs may have the same name more than once in IGV. To make it clearer which graph is currently open, all graphs within a group are now enumerated with `1.`, `2.`, `3.` , etc. Similarly, groups are enumerated with `1 -`, `2 -`, etc.
>
> <img width="696" alt="overview" src="https://user-images.githubusercontent.com/71546117/198584142-887d323b-214d-4034-9b6f-318c697c8bdd.png">
>
> The make it even further easier to distinguish different graphs and group, we can now rename them.
> To rename them:
> 1. click on a graph or group once to select it (does not have to be opened).
> 2. click a second time on the selected graph and wait 1-2 seconds.
> 3. now you can rename the graph
> <img width="274" alt="rename_group" src="https://user-images.githubusercontent.com/71546117/198584168-2c3032fc-550f-42a9-9636-f0bf9483d18b.png">
> <img width="311" alt="rename_graph" src="https://user-images.githubusercontent.com/71546117/198584177-dce038b8-ffed-411c-9547-c8f04b97474c.png">
>
> The numbering always starts at 1 and is continuous from 1 to N for N graphs. When a graph is deleted, the numbering of the following graphs changes. This implementation allows the keep the XML format unchanged, because the numbering is only local and not part of the name. However, if a graph/group is renamed, the name in the XML file will also change when it is saved.
>
> # Implementierung
> The renaming is simply enabled by overriding `canRename() {return true;}` in `FolderNode` and `GraphNode`
>
> The numbering is implemented in `getDisplayName()` in `Group` and `InputGraph` by concatenating the index of the group/graph with the name.
>
> When a group/graph is deleted the we trigger an update of the index in `FolderNode` -> `destroyNodes(Node[] nodes)` by calling `node.setDisplayName(node.getDisplayName())` for all nodes.
>
> Refresh the group/graph name in the `EditorTopComponent` of the opened graph is a bit tricky. It is implemented by adding a `Listener` to the `getDisplayNameChangedEvent()` of the currently opened `InputGraph` in `DiagramViewModel`. `getDisplayNameChangedEvent()` is fired whenever the name or the group name of the corresponding `InputGraph` is changed.
Tobias Holenstein has updated the pull request incrementally with two additional commits since the last revision:
- missing imports
- added RenameAction with shortcut
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/10873/files
- new: https://git.openjdk.org/jdk/pull/10873/files/d7fb0854..4f36c623
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=10873&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=10873&range=00-01
Stats: 36 lines in 4 files changed: 28 ins; 0 del; 8 mod
Patch: https://git.openjdk.org/jdk/pull/10873.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/10873/head:pull/10873
PR: https://git.openjdk.org/jdk/pull/10873
More information about the hotspot-compiler-dev
mailing list