Get the path to a plugin:
Platform.getbundle ("Mypluginid"). GetLocation ().
After Eclipse uses OSGi, it seems to be able to:
Activator.getdefault (). Getbundle (). GetLocation (). (provided that the plugin has activator this class. This class inherits the Eclipse's plugin Class)
Eclipse seems to be using OSGi before it looks like this:
Myplugin.getdefault (). Getbundle (). GetLocation (). (provided that the plugin has myplugin this class. This class inherits the Eclipse's plugin Class)
2. Get the workspace path: platform.getlocation ();
Resourcesplugin.getworkspace (); as if
Platform.getinstancelocation () is also possible
3. Get the Eclipse installation path
Platform.getinstalllocation ();
4. Obtain the absolute path from the plugin:
Aaaaplugin.getdefault (). Getstatelocation (). Makeabsolute (). ToFile (). GetAbsolutePath ()
Get project from a file:
IProject project = ((IFile) O). Getproject ();
Get the full path through the file:
String Path = ((IFile) O). GetLocation (). Makeabsolute (). ToFile (). GetAbsolutePath ();
Get the root of the whole workspace:
Iworkspaceroot root = Resourcesplugin.getworkspace (). Getroot ();
To find a resource from the root:
Iresource resource = Root.findmember (new Path (containername));
To find resources from bundles:
Bundle bundle = Platform.getbundle (pluginID);
URL fullpathstring = Bundleutility.find (bundle, FilePath);
Get appliaction Workspace:
Platform.aslocalurl (Product_bundle.getentry (")). GetPath ()). GetAbsolutePath ();
Get Runtimeworkspace:
Platform.getinstancelocation (). GetURL (). GetPath ();
To get an edit file from the editor
Ieditorpart editor = ((Defaulteditdomain) (Parent.getviewer (). Geteditdomain ())). Geteditorpart ();
Ieditorinput input = Editor.geteditorinput ();
if (input instanceof ifileeditorinput) {
IFile file = ((ifileeditorinput) input). GetFile ();
}
Get the absolute path to the plugin:
Filelocator.resolve (Builduiplugin.getdefault (). Getbundle (). Getentry ("/")). GetFile ();
Eclipse Knowledge Rollup