[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform] Re: The type org.eclipse.core.resources.IFile cannot be resolved. It is indirectly referenced from , required .class files

Ed, Jan,

I have a similar problem with IFile -- except it happens at run time. I have a snippet of code in a menu action delegate that checks the current selection to see if it is a file, e.g.

	ISelection current_selection = null;

	public void selectionChanged(IAction action, ISelection selection) {
	  current_selection = selection;
	}

	public void run(IAction action) {
	  if( current_selection instanceof IStructuredSelection ) {
	    IStructuredSelection s = (IStructuredSelection) current_selection;
	    Object ob = s.getFirstElement();
 	    IFile ifile = null;
	    if( ob instanceof IFile ) ifile = (IFile) ob;

.. code to open and read the file ..
}



At runtime I get a NoClassDefFoundError thrown at the "instanceof IFile" evaluation. Doesnt seem to happen on the preceeding "instanceof IStructuredSelection" evaluation, however.


I have org.eclipse.core.resources in my plugin dependencies but it looks like the runtime can't get at the IFile class def. Do I need to force the loading of the org.eclipse.core.resources plugin? Any idea what I am missing? I'm not an eclipse expert so this is probably something really simple.

FYI I'm testing the plugin in my WID 6.0.1 environment.

Thanks!