Validate grid width bounds and qualify Archiver window and document states in IntelliJ

This commit is contained in:
2026-11-25 12:08:18 +01:00
parent 2df25985ce
commit ff6ba0a745
12 changed files with 429 additions and 65 deletions
@@ -80,7 +80,8 @@ public final class DocumentTabsTargetProbe {
} else {
result = checkDetails(dir, root, id);
}
Files.writeString(dir.resolve("result-" + id), result);
var completed = Files.writeString(dir.resolve("result-" + id + ".tmp"), result);
Files.move(completed, dir.resolve("result-" + id), StandardCopyOption.ATOMIC_MOVE);
} catch (Throwable error) {
var trace = new java.io.StringWriter();
error.printStackTrace(new java.io.PrintWriter(trace));
@@ -260,29 +261,25 @@ public final class DocumentTabsTargetProbe {
long activateAfter = 0;
while (System.nanoTime() < deadline) {
if (System.nanoTime() >= activateAfter
&& !fx(field::isFocused)
&& !fx(() -> field.isFocused() && field.getScene().getWindow().isFocused())
&& System.getProperty("os.name").startsWith("Mac")) {
String activate =
"ObjC.import('AppKit');"
+ " $.NSRunningApplication.runningApplicationWithProcessIdentifier("
+ ProcessHandle.current().pid()
+ ").activateWithOptions(2)";
new ProcessBuilder("/usr/bin/osascript", "-l", "JavaScript", "-e", activate)
.redirectErrorStream(true)
.start()
.waitFor(5, TimeUnit.SECONDS);
var desktop = java.awt.Desktop.getDesktop();
if (desktop.isSupported(java.awt.Desktop.Action.APP_REQUEST_FOREGROUND)) {
// Request activation from the preview process itself, which owns the FX stage.
desktop.requestForeground(true);
}
activateAfter = System.nanoTime() + TimeUnit.SECONDS.toNanos(3);
}
boolean matched =
fx(
() -> {
var stage = (Stage) field.getScene().getWindow();
if (!field.isFocused()) {
if (!stage.isFocused() || !field.isFocused()) {
stage.toFront();
stage.requestFocus();
field.requestFocus();
}
if (!field.isFocused()) return false;
if (!stage.isFocused() || !field.isFocused()) return false;
if (!suggestions(field).contains(suggestion))
throw new AssertionError(
"Missing " + suggestion + " in catalogue " + suggestions(field));
@@ -315,6 +312,10 @@ public final class DocumentTabsTargetProbe {
+ field.isFocused()
+ ", stage focused="
+ field.getScene().getWindow().isFocused()
+ ", focus owner="
+ field.getScene().getFocusOwner()
+ ", field bounds="
+ field.localToScreen(field.getBoundsInLocal())
+ ", catalogue="
+ suggestions(field)
+ ", windows="