apache / apache/netbeans

Floating TopComponents are not correctly restored on role switch when NB.WinSys.WinSys.Show.Hide.MainWindow.While.Switching.Role is false

Open
#9,346 0 comments 0 reactions 0 assignees View on GitHub
kind:bug needs:triage Platform UI
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 29

### What happened

I am switching roles with `WindowManager.getDefault().setRole()`. When coming back to a previous role, everything is restored correctly, until I set the option `NB.WinSys.WinSys.Show.Hide.MainWindow.While.Switching.Role` to `false`. In this case floating TopComponents are reopened, but appear at position 0/0 with size 0/0.

My expectation is, that this flag changes the behavior of the main window when switching roles, but not the behavior of the role-switch itself. So even with the flag set to `false` all TopComponents of the role should be restored correctly.

### Language / Project Type / NetBeans Component

Java Maven Project

### How to reproduce

I have written a reproducer: https://gitlab.com/cdbleu_projects/nb_roleswitch_reproducer

The Reproducer contains a README wich contains furhter information on how to use the reproducer and what exactly happpens.

### Did this work correctly in an earlier version?

No / Don't know

### Operating System

WIndows 11 and Linux (RHEL 9)

### JDK

JDK 25 (could also reproduce it with JDK 21)

### Apache NetBeans packaging

Apache NetBeans platform

### Anything else

The problem can be reproduced very reliably (100% ;) ).
It can also be reproduced with NetBeans 28 (I didn't try it with earlier versions.)

As I don't know exactly what the problem it (and whether there might be some intended behavior included) I can't take care of a pull request.

### Are you willing to submit a pull request?

No

Contributor guide

Open the contributing guide

Research direction

Start with WindowManager.getDefault().setRole() and the NB.WinSys.WinSys.Show.Hide.MainWindow.While.Switching.Role option. Follow the linked reproducer and its README to observe the role switch with the option set to false. Done means floating TopComponents from the previous role reopen with their saved positions and sizes instead of at 0/0 with size 0/0.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.