Friday, August 22, 2014

Converting Java io File to eclipse IFile resource


Below function will convert java.io File to eclipse IFile resource.

public IFile convert(File file) {
   IWorkspace workspace= ResourcesPlugin.getWorkspace();  
   IPath location= Path.fromOSString(file.getAbsolutePath());
   IFile ifile= workspace.getRoot().getFileForLocation(location);
 return ifile;

}

This works only when resource exists with in the workspace.

Accessing the resources outside the workspace:
http://wiki.eclipse.org/FAQ_How_do_I_open_an_editor_on_a_file_outside_the_workspace%3F

1 comment:

  1. Once someone converts to become a customer, several factors can affect the after-sales relationship. Your customer service, communications, and order fulfillment will determine customer satisfaction levels. Ultimately, if you get it right, you can encourage more customers to come back, delivering higher Customer Lifetime Value (CLV) for your business.
    https://ppcexpo.com/blog/awareness-consideration-conversion

    ReplyDelete