Bug 61841 SWTError: Cannot set data in clipboard
I200405111600 I've seen this before so it's not new in this build. I selected 3 or 4 lines and pressed Control-X (cut) and got a dialog that said "A SWT error has occurred. You are recommended to exit the workbench". The same thing happens if I press Control-C (copy). The text does get into the clipboard but is sometimes not cut from the original source file (Java code). (Note: I saw bugzilla entries with similar but not quite the same traceback so this may or may not be a dup.) Windows XP SP1, JDK1.4.2_04. Error May 11, 2004 21:56:41.728 Cannot set data in clipboard org.eclipse.swt.SWTError: Cannot set data in clipboard at org.eclipse.swt.dnd.DND.error(DND.java:225) at org.eclipse.swt.dnd.DND.error(DND.java:181) at org.eclipse.swt.dnd.Clipboard.setContents(Clipboard.java:289) at org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAction.doCutCopyWithIm portsOperation(ClipboardOperationAction.java:301) at org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAction.internalDoOpera tion(ClipboardOperationAction.java:245) at org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAction$1.run (ClipboardOperationAction.java:223) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAction.run (ClipboardOperationAction.java:221) at org.eclipse.jface.action.Action.runWithEvent(Action.java:881) at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:141) at org.eclipse.ui.internal.commands.Command.execute(Command.java:132) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand (WorkbenchKeyboard.java:468) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press (WorkbenchKeyboard.java:886) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent (WorkbenchKeyboard.java:927) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings (WorkbenchKeyboard.java:545) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$2 (WorkbenchKeyboard.java:493) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$1.handleEvent (WorkbenchKeyboard.java:258) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:712) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:795) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:820) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:805) at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1724) at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1720) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3048) at org.eclipse.swt.widgets.Control.windowProc(Control.java:2951) at org.eclipse.swt.widgets.Display.windowProc(Display.java:3291) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1466) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2388) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1353) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1324) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:243) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:141) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:90) at org.eclipse.core.internal.runtime.PlatformActivator$1.run (PlatformActivator.java:298) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:249) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:126) 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.core.launcher.Main.basicRun(Main.java:269) at org.eclipse.core.launcher.Main.run(Main.java:722) at org.eclipse.core.launcher.Main.main(Main.java:706)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ClipboardOperationAction.java
public static class ClipboardData {
		
		private String fOriginHandle;
		private String[] fImports;
						
		public ClipboardData(IJavaElement origin, String[] imports) {
			fImports= imports;
			fOriginHandle= origin.getHandleIdentifier();
		}
		
		public ClipboardData(byte[] bytes) throws IOException {
			DataInputStream dataIn = new DataInputStream(new ByteArrayInputStream(bytes));
			
			fOriginHandle= dataIn.readUTF();
			int count= dataIn.readInt();
			
			fImports= new String[count];
			for (int i = 0; i < count; i++) {
				fImports[i]= dataIn.readUTF();
			}
			
			dataIn.close();