yugalatea / gwt-google-apis

Automatically exported from code.google.com/p/gwt-google-apis
0 stars 0 forks source link

Gears: Desktop.openFiles() callback throws CastCastException #239

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Found in Release:
1.2.0

Detailed description:
from rakesh:
Is the factory.createDesktop().openFiles() hosted mode issue fixed in
this release?
I was not able to get it working with this new code release either.
This issue was raised and discussed in the earlier patch, however no
legitimate solution ever came up.

Here is the exception message. It comes up when the user select one or
multiple files and then hits Open:
java.lang.ClassCastException
       at java.lang.Class.cast(Class.java:2951)
       at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:128)
       at com.google.gwt.dev.shell.ie.SwtOleGlue.convertVariantsToObjects
(SwtOleGlue.java:57)
       at com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod
(IDispatchImpl.java:119)
       at com.google.gwt.dev.shell.ie.IDispatchProxy.invoke
(IDispatchProxy.java:155)
       at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke
(IDispatchImpl.java:294)
       at com.google.gwt.dev.shell.ie.IDispatchImpl.method6
(IDispatchImpl.java:194)
       at org.eclipse.swt.internal.ole.win32.COMObject.callback6
(COMObject.java:117)
       at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
       at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)
       at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
       at com.google.gwt.dev.GWTShell.pumpEventLoop(GWTShell.java:720)
       at com.google.gwt.dev.GWTShell.run(GWTShell.java:593)
       at com.google.gwt.dev.GWTShell.main(GWTShell.java:357)

Here is sample code:
public class Gears implements EntryPoint{

       public void onModuleLoad() {
               TextBox t = new TextBox();
               RootPanel.get().add(t);
               t.addClickListener(new ClickListener(){

                       public void onClick(Widget sender) {
                               final Factory factory = Factory.getInstance();
                               factory.createDesktop().openFiles(new
OpenFilesHandler(){

                                       public void
onOpenFiles(OpenFilesEvent event) {

Window.alert(event.getFiles().toString());
                                       }

                               }, true);
                       }

               });
       }

}

Workaround if you have one:
Apply attached patch to gwt-gears source

Links to the relevant GWT Developer Forum posts:

Original issue reported on code.google.com by galgwt.reviews@gmail.com on 10 Feb 2009 at 1:47

Attachments:

GoogleCodeExporter commented 9 years ago
http://galgwt-reviews.appspot.com/3603/show

Original comment by galgwt.reviews@gmail.com on 10 Feb 2009 at 2:00

GoogleCodeExporter commented 9 years ago
There is still a syntax error on line 83 in Desktop.java. A "L" is missing in 
the
JSNI text. 

Here is the corrected line 83: 

@com.google.gwt.gears.client.desktop.Desktop::fireFilesOpened(Lcom/google/gwt/ge
ars/client/desktop/OpenFilesHandler;Lcom/google/gwt/core/client/JsArray;)(handle
r,
files); 

It works after this correction. 
btw, thanks for the patch. 

Original comment by rake...@gmail.com on 10 Feb 2009 at 9:22

GoogleCodeExporter commented 9 years ago
Committed in r1290

Original comment by galgwt.reviews@gmail.com on 27 Apr 2009 at 2:46

GoogleCodeExporter commented 9 years ago

Original comment by galgwt.reviews@gmail.com on 18 May 2009 at 8:02

GoogleCodeExporter commented 9 years ago
Updating account names

Original comment by zundel@google.com on 21 Dec 2009 at 2:00