mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-14 18:05:27 +07:00
Using the immediate dispatcher didn't work for the same reasons the unconfined one didn't work. Let's try using a state flow now to conflate true-false-true updates that happen in the same EDT event. A side effect is that the actual job is launched in a separate EDT event now, as we no longer use the immediate dispatcher. Because of that we need to double-check for isShowing when the actual job is launched. Another side effect is that sometimes the isShowing client property gets out of sync with the "real" isShowing. This causes exceptions when calling some Swing functions, for example, SwingUtilities.convertPoint, because they expect the component to be a part of a real UI hierarchy. To fix this, we use the real isShowing property instead of the fake one, unless we're in unit tests. The tests also had to be updated because of the new EDT events. Simple asserts were replaced by loops waiting for the expected value. Besides that, there were two important changes in the tests: 1) The "launch once is restarted" test was updated to use a counter. This is done to ensure the conflation works. 2) The modality test now actually waits for a while to ensure that the job is not launched with the wrong modality. If we don't do this, a simple yield() is no longer enough: if the modality is set to any() the test would still succeed, because when yield() returns, the EDT event that actually executes the job isn't processed yet. Reviewed in IJ-CR-168711 for 252 and release. GitOrigin-RevId: 305922a45ffa1e35e8ed965cee2795eedba7f3e7