Transferred from: http://blog.csdn.net/liaomin416100569/article/details/7165425
1. Get the system default shell Shell shell = Platformui.getworkbench (). Getactiveworkbenchwindow (). Getshell (); 2. Get additional plug-in Activetor objects Plugin p=platform.getplugin ("Org.liaomin.huqun.ftptool"); 3. Get preferences for a plugin String name=platform.getplugin ("plug-in ID"). getpluginpreferences (). getString ("Key value for preferences"); 4. Get the root directory of the workspace resourcesplugin.getworkspace (). Getroot () 5. Get a ijavaproject resourcesplugin.getworkspace (). Getroot (). Getproject ("project name") 6. Convert Iproject to Ijavaproject Ijavaproject Create = Javacore.create (p); 7 Finding the corresponding resource by Path Iworkspaceroot root = Resourcesplugin.getworkspace (). Getroot ();
Iresource resource = Root.findmember (new Path (Srcpath)),//srcpath similar to Linux/project name/directory/subdirectory 8 Restarting the Working space Platformui.getworkbench (). restart (); 8 Finding a Perspective Platformui.getworkbench (). Getperspectiveregistry (). Findperspectivewithid (Perspective image ID); 9 Getting Help information Platformui.getworkbench (). Gethelpsystem () 10 Convert JDT objects by ifile Ijavaelement Create (IFile file): Creates the corresponding Java element from the file. Ijavaelement Create (IFolder folder): Creates the corresponding Java element from the folder. Ijavaproject Create (IProject project): Get IProject corresponding ijavaproject. Ijavaelement Create (Iresource Resource): creates the corresponding Java element from the resource. Ijavamodel Create (Iworkspaceroot root): Gets the corresponding Ijavamodel from the workspace root directory. Iclassfile createclassfilefrom (IFile file): Creates the corresponding iclassfile from the file. Icompilationunit createcompilationunitfrom (IFile file): Creates the corresponding icompilationunit from the file. |
Getting global objects from Eclipse plug-in development