Community
Participate
Working Groups
N20110410-2000 Unzip the attached plug-in project and import as existing project Launch a new runtime workbench with the parameter -dir rtl Verify that Eclipse is in right to left mode Show the view TreeViewCategory/RTL tree view In the view click on an expander node Expected Result: Tree item.getItem() is null is written to the console Actual result: Tree item.getItem() is not null is written to the console This works correctly in ltr
Created attachment 193104 [details] plug-in which reproduces the problem
I have marked this as a polish item because it causes problems for the help view in RTL mode - see Bug 342617.
Silenio, any idea what's going on here?
Works for me on Fedora 14 (gtk 2.22), Chris please try my snippet and let me know if it works or it fails on your machine. import org.eclipse.swt.*; import org.eclipse.swt.widgets.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.layout.*; public class PR342648 { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); Listener listener = new Listener () { public void handleEvent(Event event) { Tree tree = (Tree)event.widget; Point p = new Point(event.x, event.y); TreeItem item = tree.getItem(p); System.out.println("point " + p + " item " + item); } }; final Tree tree = new Tree(shell, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); for (int i = 0; i < 4; i++) { TreeItem item = new TreeItem(tree, SWT.NONE); item.setText("root " + i); for (int j = 0; j < 4; j++) { TreeItem subItem = new TreeItem(item, SWT.NONE); subItem.setText("item " + j); for (int k = 0; k < 4; k++) { TreeItem subsubItem = new TreeItem(subItem, SWT.NONE); subsubItem.setText("subsubitem " + k); } } } tree.addListener(SWT.MouseDown, listener); final Tree treeRTL = new Tree(shell, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.RIGHT_TO_LEFT); for (int i = 0; i < 4; i++) { TreeItem item = new TreeItem(treeRTL, SWT.NONE); item.setText("rootRTL " + i); for (int j = 0; j < 4; j++) { TreeItem subItem = new TreeItem(item, SWT.NONE); subItem.setText("itemRTL " + j); for (int k = 0; k < 4; k++) { TreeItem subsubItem = new TreeItem(subItem, SWT.NONE); subsubItem.setText("subsubitemRTL " + k); } } } treeRTL.addListener(SWT.MouseDown, listener); shell.setSize(400, 400); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } }
On my machine the test fails in the following way: If I click on an expander in the RTL side of the screen I do not see "item null" as expected, instead I see item TreeItem.
Created attachment 193870 [details] patch
Fixed in HEAD
Verified in I20110421-1800
*** Bug 342617 has been marked as a duplicate of this bug. ***