Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

importing org.eclipse.core packages for Eclipse plug-in

I'm trying to create a plug-in to mimic the Eclipse open resource dialog (CTRL+SHIFT+R). I've learned how to create a FilteredItemsSelectionDialog by following the example. But the missing piece is how to fill the dialog with the workspace resources. I found OpenResourceHandler and am trying to duplicate this functionality in my plug-in, so I can step through and see how it works. So I copy the source and rename it to avoid colliding with the real one. The problem is that I cannot import these classes:

import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;

I tried editing my Manifest but it will not let me import org.eclipse.core (although I can import org.eclipse.core.runtime). So, where do I find these classes and how can import them? And, more importantly, in general how would I find the bundle a given class exists in and import it?

like image 769
harschware Avatar asked Feb 27 '23 19:02

harschware


1 Answers

You need to import org.eclipse.core.resources.

In general, you can open the "Plug-ins" view (Window -> Show View -> Other -> Plug-in Development -> Plug-ins). Then, select interesting plug-ins and right click -> Add to Java Search. Then you can use Open Type (Ctrl + Shift + T) to open the class.

Also, in the package explorer, change the Filters to not exclude "External plug-in libraries project". "Link with Editor" can then show you what bundle contains the class you just opened.

like image 51
Andrew Niefer Avatar answered Mar 01 '23 11:03

Andrew Niefer