Here you can find the source of toFile(IFile file)
public static File toFile(IFile file)
//package com.java2s; /******************************************************************************* * Copyright (c) 2013 Red Hat, Inc.// ww w . jav a 2s . com * Distributed under license by Red Hat, Inc. All rights reserved. * This program is made available under the terms of the * Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Red Hat, Inc. - initial API and implementation ******************************************************************************/ import java.io.File; import org.eclipse.core.resources.IFile; public class Main { public static File toFile(IFile file) { File f = file.getRawLocation() != null ? file.getRawLocation().toFile() : null; if (f == null) f = file.getLocation() != null ? file.getLocation().toFile() : null; if (f == null) f = file.getFullPath() != null ? file.getFullPath().toFile() : null; return f; } }