Eclipse Knowledge Rollup

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.