Unhandled event loop exception Raison: org.eclipse.core.internal.resources.File [message #297003] |
Fri, 06 January 2006 15:33 |
Eclipse User |
|
|
|
Originally posted by: lacmene.yahoo.fr
Hi,
I`m building a plug-in to transform the contents of an selected file. I
generated the plugin with the pde.
I want to get the File (the selection) from the view (Vavigator or package
Explorer) in the runtime workbench by reading out the selection.
The following code snippets should demonstrate my problem:
if ((theSelection instanceof
IStructuredSelection)&&(!theSelection.isEmpty())){
Object segment= ((IStructuredSelection) theSelection).getFirstElement();
String Classname = segment.getClass().getName();
System.out.println(Classname );
File theFile = (File)segment;
System.out.println(theFile.getName());
System.out.println(theFile.getFileExtension());
....
}
I checked the Classtype with :
String Classname = segment.getClass().getName();
System.out.println(Classname );
and the result was "org.eclipse.core.internal.resources.File";
so I'm sure, that I do a correct cast.
I also try to cast the Object to IFile without any succes.
This is the console output:
Unhandled event loop exception
Reason:
org/eclipse/core/internal/resources/File
Has anyone an idea?
Thanx a lot for your help.
Laurette
|
|
|
Re: Unhandled event loop exception Raison: org.eclipse.core.internal.resources.File [message #297004 is a reply to message #297003] |
Fri, 06 January 2006 15:39 |
Eclipse User |
|
|
|
Originally posted by: kwpeck.mersoft.com
Look in the .log file to get a better error message. The console just
tells you something went awry but the output in the .log file should
give you what really happened. Look a the very end of the file as it
could be quite large if you have run your application multiple times
without deleting the .log file.
Laurette Lacmene wrote:
> Hi,
>
> I`m building a plug-in to transform the contents of an selected file. I
> generated the plugin with the pde.
> I want to get the File (the selection) from the view (Vavigator or
> package Explorer) in the runtime workbench by reading out the selection.
>
> The following code snippets should demonstrate my problem:
>
> if ((theSelection instanceof
> IStructuredSelection)&&(!theSelection.isEmpty())){
> Object segment= ((IStructuredSelection)
> theSelection).getFirstElement();
> String Classname = segment.getClass().getName();
> System.out.println(Classname );
>
> File theFile = (File)segment; System.out.println(theFile.getName());
> System.out.println(theFile.getFileExtension());
> ....
> }
>
> I checked the Classtype with :
> String Classname = segment.getClass().getName();
> System.out.println(Classname );
> and the result was "org.eclipse.core.internal.resources.File"; so I'm
> sure, that I do a correct cast. I also try to cast the Object to IFile
> without any succes.
>
> This is the console output:
> Unhandled event loop exception
> Reason:
> org/eclipse/core/internal/resources/File
>
>
> Has anyone an idea?
> Thanx a lot for your help.
>
> Laurette
>
|
|
|
|
Re: Unhandled event loop exception Raison: org.eclipse.core.internal.resources.F [message #297028 is a reply to message #297004] |
Fri, 06 January 2006 17:23 |
Eclipse User |
|
|
|
Originally posted by: lacmene.yahoo.fr
Hi Kevin,
Hier is the output from the .log file. It doesn't make sence because the
exception is raised exactly where i do the cast:
at
com.fokus.uml2__u2tp.actions.SampleAction.getThefile(SampleA ction.java:127)
!ENTRY org.eclipse.ui 4 4 2006-01-06 18:10:39.865
!MESSAGE Unhandled event loop exception
!ENTRY org.eclipse.ui 4 0 2006-01-06 18:10:39.865
!MESSAGE org.eclipse.core.internal.resources.File
!STACK 0
java.lang.ClassCastException: org.eclipse.core.internal.resources.File
at
com.fokus.uml2__u2tp.actions.SampleAction.getThefile(SampleA ction.java:127)
at com.fokus.uml2__u2tp.actions.SampleAction.run(SampleAction.j ava:69)
at
org.eclipse.ui.internal.PluginAction.runWithEvent(PluginActi on.java:246)
at
org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPl uginAction.java:223)
at
org.eclipse.jface.action.ActionContributionItem.handleWidget Selection(ActionContributionItem.java:538)
at
org.eclipse.jface.action.ActionContributionItem.access$2(Act ionContributionItem.java:488)
at
org.eclipse.jface.action.ActionContributionItem$6.handleEven t(ActionContributionItem.java:441)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3080)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2713)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1699)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:367)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:143)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:103)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:226)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:376)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:163)
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.invokeFramework(Main.java:334 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
at org.eclipse.core.launcher.Main.run(Main.java:973)
at org.eclipse.core.launcher.Main.main(Main.java:948)
thanx
Laurette
|
|
|
|
|
Re: Unhandled event loop exception Raison: org.eclipse.core.internal.resources.File [message #297246 is a reply to message #297003] |
Tue, 10 January 2006 21:21 |
Eclipse User |
|
|
|
Originally posted by: john.eclipsefaq.org
You shouldn't be referencing org.eclipse.core.internal.resources.File.
Cast to the org.eclipse.core.resource.IFile interface instead.
--
Laurette Lacmene wrote:
> Hi,
>
> I`m building a plug-in to transform the contents of an selected file. I
> generated the plugin with the pde.
> I want to get the File (the selection) from the view (Vavigator or
> package Explorer) in the runtime workbench by reading out the selection.
>
> The following code snippets should demonstrate my problem:
>
> if ((theSelection instanceof
> IStructuredSelection)&&(!theSelection.isEmpty())){
> Object segment= ((IStructuredSelection)
> theSelection).getFirstElement();
> String Classname = segment.getClass().getName();
> System.out.println(Classname );
>
> File theFile = (File)segment; System.out.println(theFile.getName());
> System.out.println(theFile.getFileExtension());
> ....
> }
>
> I checked the Classtype with :
> String Classname = segment.getClass().getName();
> System.out.println(Classname );
> and the result was "org.eclipse.core.internal.resources.File"; so I'm
> sure, that I do a correct cast. I also try to cast the Object to IFile
> without any succes.
>
> This is the console output:
> Unhandled event loop exception
> Reason:
> org/eclipse/core/internal/resources/File
>
>
> Has anyone an idea?
> Thanx a lot for your help.
>
> Laurette
>
|
|
|
Powered by
FUDForum. Page generated in 0.03978 seconds