Demo
Http://www.cnblogs.com/liuzhuo/archive/2010/08/15/eclipse_plugin_1_1_1.html
The API for Workbench and resource access is the most basic of the APIs provided by Eclipse, and uses a higher frequency API for plug-in development. No detailed instructions are given here, and some of these APIs will appear in future examples. Using Platformui as the entry point for the Workbench and the entry point to use Resourcesplugin as a workspace access is to be remembered anyway.
using Platformui to access the work desk
Get the work table Iworkbench Workbench = Platformui.getworkbench (); Get the workbench window Iworkbenchwindow windows = Workbench.getactiveworkbenchwindow (); Iworkbenchpage page = Window.getactivepage (); Gets the editor window that is currently active ieditorpart part = Page.getactiveeditor ();
using Resourcesplugin to access workspaces
Gets the root iworkspaceroot wsroot = Resourcesplugin.getworkspace () of the workspace. Getroot (); Get Project iproject[] projects = Wsroot.getprojects (); |