Last active
December 15, 2015 16:29
-
-
Save suxiaogang/5289991 to your computer and use it in GitHub Desktop.
File <-> IFile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//File > IFile: | |
IContainer[] findContainersForLocationURI = ResourcesPlugin.getWorkspace().getRoot().findContainersForLocationURI( | |
file.toURI()); | |
IFile[] findFilesForLocationURI = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(filefile.toURI()); | |
//IFile > File: | |
IProject fsProject = ResourceModelUtils.getProject(project); | |
IFolder tmpFolder = ResourceUtils.getFolder(fsProject, RepositoryConstants.TEMP_DIRECTORY, true); | |
String tmpFilename = "DOC" + documentationItem.getProperty().getId(); | |
IFile fileTmp = tmpFolder.getFile(tmpFilename);//Get IFile reference by file name; | |
File file = fileTmp.getLocation().toFile(); //Get File reference by IFile reference. | |
File newFile = new File(fileTmp.getLocation().toOSString()); //Convert IFile to File. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment