From 963cd6bf96fce4083a7465d5f2ecc6f54bdbe04c Mon Sep 17 00:00:00 2001 From: Luise Ravnskjaer Date: Thu, 8 Oct 2026 21:28:45 +0200 Subject: [PATCH] Remove try/catch workaround in BreakpointLabelAction The workaround in computeInlineEditorBounds() caught the ArrayIndexOutOfBoundsException thrown by TreeItem.getBounds() on macOS. That exception is fixed in SWT by https://github.com/eclipse-platform/eclipse.platform.swt/pull/3628 (included in I-builds from I20261007-2300 onwards), so the workaround is no longer needed. Follow-up to https://github.com/eclipse-platform/eclipse.platform.swt/issues/2749 --- .../breakpoints/BreakpointLabelAction.java | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointLabelAction.java b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointLabelAction.java index cd4fa4071dc..0b452e75f82 100644 --- a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointLabelAction.java +++ b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointLabelAction.java @@ -111,28 +111,11 @@ public void keyPressed(KeyEvent e) { } private static Rectangle computeInlineEditorBounds(TreeItem treeItem) { - Rectangle bounds; - try { - bounds = treeItem.getBounds(); - } catch (ArrayIndexOutOfBoundsException e) { - // TreeItem having FontData [Breakpoints having custom label] - bounds = macBugWorkaround(treeItem); - } + Rectangle bounds = treeItem.getBounds(); int editorWidth = Math.max(computeEditorExtent(treeItem), bounds.width); return new Rectangle(bounds.x, bounds.y, editorWidth, bounds.height); } - // Workaround for SWT bug on Mac where TreeItem.getBounds() throws exception - // when custom fonts are used, see - // https://github.com/eclipse-platform/eclipse.platform.swt/issues/2749 - private static Rectangle macBugWorkaround(TreeItem treeItem) { - treeItem.setFont(null); - Rectangle bounds = treeItem.getBounds(0); - bounds.x = bounds.x + 10; - bounds.width = computeEditorExtent(treeItem); - return bounds; - } - private static int computeEditorExtent(TreeItem treeItem) { GC gc = new GC(treeItem.getParent()); try {