Bug 193155

Summary: [Scratchpad] Double Clicking on a String in the Scratchpad Errors
Product: [Tools] Target Management Reporter: Kevin Doyle <kjdoyle>
Component: RSEAssignee: Kevin Doyle <kjdoyle>
Status: CLOSED FIXED QA Contact: Martin Oberhuber <mober.at+eclipse>
Severity: minor    
Priority: P4 CC: ddykstal.eclipse, dmcknigh, kmunir
Version: 2.0Keywords: contributed
Target Milestone: 2.0.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 193158    
Bug Blocks:    
Attachments:
Description Flags
Added a check to see if element is IAdaptable mober.at+eclipse: iplog+

Description Kevin Doyle CLA 2007-06-18 13:40:57 EDT
If you paste some text to the Scratchpad and double click on it you will get a ClassCastException.

Steps to Reproduce:
1. Copy some text from some file.
2. Right click in the empty space in the Remote Scratchpad and select Paste.
3. Double click on the text.

Error Dialog Shows:
An error has occurred. See error log for more details.
java.lang.String cannot be cast to org.eclipse.core.runtime.IAdaptable

Log File Contains:
!ENTRY org.eclipse.jface 4 2 2007-06-18 13:39:18.984
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface".
!STACK 0
java.lang.ClassCastException: java.lang.String cannot be cast to org.eclipse.core.runtime.IAdaptable
	at org.eclipse.rse.internal.ui.view.scratchpad.SystemScratchpadViewPart.handleDoubleClick(SystemScratchpadViewPart.java:184)
	at org.eclipse.rse.internal.ui.view.scratchpad.SystemScratchpadViewPart.access$0(SystemScratchpadViewPart.java:176)
	at org.eclipse.rse.internal.ui.view.scratchpad.SystemScratchpadViewPart$1.doubleClick(SystemScratchpadViewPart.java:122)
	at org.eclipse.jface.viewers.StructuredViewer$1.run(StructuredViewer.java:799)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.runtime.Platform.run(Platform.java:857)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:46)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:193)
	at org.eclipse.jface.viewers.StructuredViewer.fireDoubleClick(StructuredViewer.java:797)
	at org.eclipse.jface.viewers.AbstractTreeViewer.handleDoubleSelect(AbstractTreeViewer.java:1384)
	at org.eclipse.jface.viewers.StructuredViewer$4.widgetDefaultSelected(StructuredViewer.java:1173)
	at org.eclipse.jface.util.OpenStrategy.fireDefaultSelectionEvent(OpenStrategy.java:237)
	at org.eclipse.jface.util.OpenStrategy.access$0(OpenStrategy.java:234)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:295)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
	at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
	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:504)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1169)

-----------Enter bugs above this line-----------
TM 2.0RC3 Testing
installation : eclipse-SDK-3.3RC4
RSE install  : RSE 2.0 RC3
java.runtime : Sun 1.5.0_11-b03
os.name:     : Windows XP, Service Pack 2
------------------------------------------------
Comment 1 Martin Oberhuber CLA 2007-06-28 09:08:07 EDT
I guess we need to decide what to do with Strings in the Scratchpad. Strings are not RSE Objects, so we should probably not allow any operations on them, and at the place where we get the ClassCastException we should first check whether the thing is a proper RSE object.

But there is another bug open regarding Strings in the Scratchpad.
Comment 2 Martin Oberhuber CLA 2007-06-28 09:09:00 EDT
See bug #193158 regarding the general decision what to do with Strings.
Comment 3 Kevin Doyle CLA 2007-07-11 14:42:21 EDT
Created attachment 73581 [details]
Added a check to see if element is IAdaptable

Legal Message: I, Kevin Doyle, declare that I developed attached code from
scratch, without referencing any 3rd party materials except material licensed
under the EPL. I am authorized by my employer, IBM Canada Ltd. to make this
contribution under the EPL.
Comment 4 David McKnight CLA 2007-07-11 15:01:46 EDT
I've committed the fix for this.
Comment 5 Kevin Doyle CLA 2007-07-15 15:52:04 EDT
Verified with I20070713-0605.