RFR: 8265433: IGV: add group, graph, and node tooltips with properties
Roberto Castañeda Lozano
rcastanedalo at openjdk.org
Thu Aug 4 12:06:56 UTC 2022
On Thu, 4 Aug 2022 08:52:58 GMT, Koichi Sakata <ksakata at openjdk.org> wrote:
> This pull request adds tooltips that show properties to groups and graphs in the Outline window and remaining nodes in the graph view window.
>
> # Tests
>
> There are no test classes correspond to classes that this PR changed. So I tested manually. Screenshots are as follows.
>
> ## Screenshots
> ### Group in Outline Window
> <img width="500" alt="スクリーンショット 2022-07-15 17 19 28" src="https://user-images.githubusercontent.com/60008/182804933-3df1ebdb-c0eb-4df6-ae45-aa4ccfe9f9fc.png">
>
> ### Graph in Outline Window
> <img width="500" alt="スクリーンショット 2022-07-15 17 17 29" src="https://user-images.githubusercontent.com/60008/182805052-96824754-e9f5-41c6-9e6c-eadd62238f12.png">
>
> ### Graph View Window
> <img width="500" alt="スクリーンショット 2022-07-15 17 18 31" src="https://user-images.githubusercontent.com/60008/182804997-b69af84e-9c83-4747-83d8-171162c8072c.png">
>
> # Details
>
> I added a new class, which is `PropertiesConverter`, to format text in tooltip. We can use HTML tags for formatting tooltip text. `PropertiesConverter` converts Properties object to HTML string. If there is a more appropriate class for processing it, please let me know.
>
> This PR has one side effect. When an item in Outline window is selected, the description in the properties window, which is at the bottom right of each image, shows the same content as the tooltip. Before applying this PR, only the name was shown in that. The reason is that the property window shows the return value of `getShortDescription()` of the node object by default. The value is also used for tooltip. That is explained in `org.openide.nodes.Node` class. So I overrided the method.
>
>
> /** Set the short description of the node. Fires a property change event.
> * <p>This description may be used for tool tips, etc.
> * @param s the new description
> */
> @Override
> public void setShortDescription(String s) {
>
> https://github.com/apache/netbeans/blob/master/platform/openide.nodes/src/org/openide/nodes/Node.java
>
> In the case of Graph View window, the properties window stays as it was. Because Widget class has `setToolTipText` method for tooltip.
>
> # Concerns
>
> As stated earlier, contents of the description depends on the window the selected item is in. I'm concerned about this behavior.
Thanks for working on this, @jyukutyo! In my opinion, most of the value of this changeset is in the node tooltips in the graph view window, where the user typically spends most of the time. Given that there does not seem to exist a workaround for the concern you describe, maybe we could limit this PR (updating the title and JBS issue) to graph view window tooltips only?
src/utils/IdealGraphVisualizer/Util/src/main/java/com/sun/hotspot/igv/util/PropertiesConverter.java line 34:
> 32: * @author ksakata
> 33: */
> 34: public class PropertiesConverter {
This class should escape at least the most common HTML characters. See for example the difference in the `dump_spec` property in the tooltip and in the Properties window:

Luckily, there is already a helper method for escaping HTML: [com.sun.hotspot.igv.util.StringUtils::escapeHTML](https://github.com/openjdk/jdk/blob/ce61eb6ff99eaaece463091b8481e27f84f80684/src/utils/IdealGraphVisualizer/Util/src/main/java/com/sun/hotspot/igv/util/StringUtils.java#L33).
src/utils/IdealGraphVisualizer/View/src/main/java/com/sun/hotspot/igv/view/widgets/FigureWidget.java line 90:
> 88: public Node getNode() {
> 89: return node;
> 90: }
For ease of reviewing, backporting, etc. please do not include unrelated code clean-ups.
-------------
Changes requested by rcastanedalo (Reviewer).
PR: https://git.openjdk.org/jdk/pull/9740
More information about the hotspot-compiler-dev
mailing list