RFR: JDK-8265441: IGV: select block nodes by clicking on it
Tobias Holenstein
tholenstein at openjdk.org
Tue Oct 25 17:00:39 UTC 2022
In "Cluster nodes into blocks" mode, it is now possible to select all nodes in a block by simply double-clicking in the block. The attached images illustrate the new behavior, after double-clicking on block B10. Similarly, the current node selection can be extended with all nodes of a block when holding the Ctrl/Cmd-key and double-clicking on a block.

# Overview selection
new selection modes in **bold**. We refer to B4/B10 as _blocks_, and 86, 87, 88, ... as _nodes_
## no key pressed
+ `click on single node` : select single node, unselect all other nodes
+ `click on edge` : select src/dest nodes, unselect all other nodes
+ **`double-click on block` : select all nodes in block, unselect all other nodes**
+ **`double-click outside of node/block` : unselect all nodes**
## holding down Ctrl/Cmd
+ `click on single node` : add node to current selection
+ `click on edge` : invert the selection of src/dest nodes
+ **`double-click on block` : add all nodes in block to current selection**
+ `draw selection rectangle` : **invert** the selection of all nodes in rectangle
- select unselected nodes, **unselect selected nodes**
# Implementation
The main functionality was implemented by extending `BlockWidget` with `DoubleClickHandler` and adding methods `handleDoubleClick` / `addToSelection`. We also needed to replace `setSelectedNodes` with `clearSelectedNodes` and `addSelectedNodes` in `InputGraphProvider` and the corresponding methods in `EditorTopComponent`. All code that used `setSelectedNodes` needed to be adjusted accordingly.
In order for the `DoubleClickHandler` in `BlockWidget` to work, we needed to extend `selectAction` in `DiagramScene` to _invert_ the selection of the nodes in the rectangle (the `symmetricDiff` set).
-------------
Commit messages:
- JDK-8265441: IGV: select block nodes by clicking on it
Changes: https://git.openjdk.org/jdk/pull/10854/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10854&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8265441
Stats: 260 lines in 16 files changed: 72 ins; 104 del; 84 mod
Patch: https://git.openjdk.org/jdk/pull/10854.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/10854/head:pull/10854
PR: https://git.openjdk.org/jdk/pull/10854
More information about the hotspot-compiler-dev
mailing list