RFR: JDK-8290063: IGV: Give the graphs a unique number in the outline
Tobias Hartmann
thartmann at openjdk.org
Wed Nov 2 06:59:27 UTC 2022
On Wed, 26 Oct 2022 14:02:11 GMT, Tobias Holenstein <tholenstein at openjdk.org> wrote:
> 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.
It works well for me but I'm wondering if "click and wait for 1-2 seconds" (which is more like 3 seconds on my system) should be replaced by an entry in the right-click menu. For fast renaming, a shortcut (F2) can be used, which already works.
I spotted the following (existing) issue:
- Open Phase 5
- Delete Phase 2
- The graph changes. Phase 6 is now displayed while the selection still shows Phase 5.
I don't think deleting a non-opened phase should affect the currently opened one, right?
-------------
PR: https://git.openjdk.org/jdk/pull/10873
More information about the hotspot-compiler-dev
mailing list