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. 开发者_JS百科 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?
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.
精彩评论