RFR: JDK-8292669: IGV: Search not useable when in Overflow Toolbar

Tobias Holenstein tholenstein at openjdk.org
Wed Aug 24 13:05:19 UTC 2022


## Overview

The toolbar of the `EditorTopComponent` uses an overflow toolbar when it does not fit in the width of the TopComponent. When the window was not wide enough the `QuickSearch` used to land in the overflow toolbar. Unfortunately, `QuickSearch` stops working in the overflow toolbar.

Now the `QuickSearch` never lands in the overflow toolbar anymore as shown bellow: 
<img width="922" alt="ToolbarOverflow" src="https://user-images.githubusercontent.com/71546117/186420098-5fcb2348-b955-40c5-b5ca-2bc38525ffcf.png">

Since the Netbeans Platform only allows for one occurrence of `QuickSearch`, it is only shown in the `EditorTopComponent` that was selected last. 

## Implementation
We introduce a new `JPanel` named `topPanel` as a parent container. 
<img width="889" alt="topPanel" src="https://user-images.githubusercontent.com/71546117/186420990-9888e17d-6c45-4b7d-86a5-1fe2981f197d.png">

`topPanel` contains another  `JPanel` `toolbarPanel` and a `Toolbar` `quickSearchToolbar`:
<img width="889" alt="Toolbars" src="https://user-images.githubusercontent.com/71546117/186421595-08a74998-b783-43f1-bd15-c41e7fdcbd23.png">

`toolbarPanel` uses the `GridLayout` which gives the original `Toolbar` `toolBar` the maximal available width while still allowing it to overflow. 
On the right we have `quickSearchToolbar`, a `Toolbar` with a single element `quickSearchPresenter`. We give `quickSearchPresenter` a minimum size and use the `BoxLayout` in `quickSearchToolbar` that respects the minimum size of its children.  Therefore the `quickSearchToolbar` never overflows. 
<img width="889" alt="Toolbars_inner" src="https://user-images.githubusercontent.com/71546117/186421729-2591e753-a111-4d09-9fc6-14839730b669.png">

-------------

Commit messages:
 - make quickSearch work on Linux
 - JDK-8292669: IGV: Search not useable when in Overflow Toolbar

Changes: https://git.openjdk.org/jdk/pull/9940/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=9940&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8292669
  Stats: 133 lines in 3 files changed: 57 ins; 57 del; 19 mod
  Patch: https://git.openjdk.org/jdk/pull/9940.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/9940/head:pull/9940

PR: https://git.openjdk.org/jdk/pull/9940


More information about the hotspot-compiler-dev mailing list