Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 317614

Summary: [Forms] FormText: IllegalArgumentException when copying empty selection - Fix for Eclipse 3.7
Product: [Eclipse Project] Platform Reporter: Chris Goldthorpe <cgold>
Component: User AssistanceAssignee: Chris Goldthorpe <cgold>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: cgold, konstantin
Version: 3.6   
Target Milestone: 3.7 M1   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Chris Goldthorpe CLA 2010-06-22 12:40:00 EDT
+++ This bug was initially created as a clone of Bug #316997 +++

If the user goes to select text in FormText control and ends up with empty selection, the control doesn't always realize that no selection happened. It might take a few tries to reproduce this. I found that it helps to start selection and then move slightly down (not enough to go to the next line) before ending the selection. 

You can tell that the control thinks there is a selection present by the fact that Copy menu item is enabled. It might take a few tries to get into this state, but once you are there invoking Copy causes the following exception:

java.lang.IllegalArgumentException: Argument not valid
at org.eclipse.swt.SWT.error(SWT.java:3865)
at org.eclipse.swt.SWT.error(SWT.java:3799)
at org.eclipse.swt.SWT.error(SWT.java:3770)
at org.eclipse.swt.dnd.DND.error(DND.java:282)
at org.eclipse.swt.dnd.DND.error(DND.java:228)
at org.eclipse.swt.dnd.Clipboard.setContents(Clipboard.java:480)
at org.eclipse.swt.dnd.Clipboard.setContents(Clipboard.java:411)
at org.eclipse.ui.forms.widgets.FormText.copy(FormText.java:1085)
at
org.eclipse.ui.forms.widgets.FormText$10.widgetSelected(FormText.java:920)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:228)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3910)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3503)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.ja
va:113)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:19
4)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(Ec
lipseAppLauncher.java:110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppL
auncher.java:79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
Comment 1 Chris Goldthorpe CLA 2010-06-22 12:42:43 EDT
The patch from Bug #316997 has been applied to HEAD, Fixed.