Java File Object Create toFile(IFile file)

Here you can find the source of toFile(IFile file)

Description

to File

License

Open Source License

Declaration

public static File toFile(IFile file) 

Method Source Code

//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;
    }
}

Related

  1. toFile(File baseDir, String path)
  2. toFile(File currentDirectory, String file)
  3. toFile(File dir, String[] path)
  4. toFile(File dstPath, String fullClassName)
  5. toFile(File file, byte[] data)
  6. toFile(InputStream in, File file)
  7. toFile(InputStream inputStream)
  8. toFile(JavaFileObject javaFileObject)
  9. toFile(List filenames)