Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading