Project: SWT
Bug 48272 pocket pc - gesture erases current text selection
Reported: 2003-12-08 10:00:35 | Status: resolved fixed

PPC: select some text, then bring up a popup. The gesture erases the current selection. It should not (e.g. see Word). import org.eclipse.swt.*; import org.eclipse.swt.widgets.*; import org.eclipse.swt.events.*; import org.eclipse.swt.layout.*; public class TextStylusHold { Display display; Shell shell; Text text; class MySelectionAdapter extends SelectionAdapter { public void widgetSelected(SelectionEvent e) { String x = ""; if (e.widget != null && e.widget.getData() != null) x = (String) e.widget.getData(); if (x.equals("POPUP_COPY")) text.copy(); } } public TextStylusHold() { display = new Display(); shell = new Shell(display); shell.setText("Main"); Menu mb = new Menu(shell, SWT.BAR); shell.setMenuBar(mb); Menu menu = new Menu(shell, SWT.POP_UP); MenuItem item = new MenuItem(menu, SWT.CASCADE); item.setData("POPUP_COPY"); item.setText("copy"); item.addSelectionListener( new MySelectionAdapter()); text = new Text(shell, SWT.MULTI); text.setText("Please,\nhere select some text\nand hold tap."); text.setMenu(menu); shell.setLayout( new FillLayout()); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } public static void main(String[] args) { new TextStylusHold(); } }

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Text.java