Java Code Examples for javax.tools.FileObject#getName()

The following examples show how to use javax.tools.FileObject#getName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavacFiler.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Check to see if the file has already been opened; if so, throw
 * an exception, otherwise add it to the set of files.
 */
private void checkFileReopening(FileObject fileObject, boolean addToHistory) throws FilerException {
    for(FileObject veteran : fileObjectHistory) {
        if (fileManager.isSameFile(veteran, fileObject)) {
            if (lint)
                log.warning("proc.file.reopening", fileObject.getName());
            throw new FilerException("Attempt to reopen a file for path " + fileObject.getName());
        }
    }
    if (addToHistory)
        fileObjectHistory.add(fileObject);
}
 
Example 2
Source File: JavacFileManager.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@DefinedBy(Api.COMPILER)
public File asPath(FileObject file) {
    if (file instanceof PathFileObject) {
        return ((PathFileObject) file).path;
    } else
        throw new IllegalArgumentException(file.getName());
}
 
Example 3
Source File: JavacFiler.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Check to see if the file has already been opened; if so, throw
 * an exception, otherwise add it to the set of files.
 */
private void checkFileReopening(FileObject fileObject, boolean addToHistory) throws FilerException {
    for(FileObject veteran : fileObjectHistory) {
        if (fileManager.isSameFile(veteran, fileObject)) {
            if (lint)
                log.warning("proc.file.reopening", fileObject.getName());
            throw new FilerException("Attempt to reopen a file for path " + fileObject.getName());
        }
    }
    if (addToHistory)
        fileObjectHistory.add(fileObject);
}
 
Example 4
Source File: JavacFileManager.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override @DefinedBy(Api.COMPILER)
public Path asPath(FileObject file) {
    if (file instanceof PathFileObject) {
        return ((PathFileObject) file).path;
    } else
        throw new IllegalArgumentException(file.getName());
}
 
Example 5
Source File: VirtualFileManager.java    From BIMserver with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public JavaFileObject getJavaFileForOutput(Location location, String className, Kind kind, FileObject sibling) throws IOException {
	String path = sibling.getName();
	String cleanPath = path;
	if (cleanPath.contains("$")) {
		cleanPath = cleanPath.substring(0, cleanPath.indexOf("$"));
	}
	if (baseDir.containsType(cleanPath)) {
		return baseDir.createFile(path.replace(".java", "").replace(".", "/") + ".class");
	}
	return null;
}
 
Example 6
Source File: JavacTrees.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private static void checkHtmlKind(FileObject fileObject, JavaFileObject.Kind kind) {
    if (kind != JavaFileObject.Kind.HTML) {
        throw new IllegalArgumentException("HTML file expected:" + fileObject.getName());
    }
}
 
Example 7
Source File: JavacTrees.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private static void checkHtmlKind(FileObject fileObject, JavaFileObject.Kind kind) {
    if (kind != JavaFileObject.Kind.HTML) {
        throw new IllegalArgumentException("HTML file expected:" + fileObject.getName());
    }
}
 
Example 8
Source File: ManifoldJavaFileManager.java    From manifold with Apache License 2.0 4 votes vote down vote up
private boolean isIntellijPluginTemporaryFile( JavaFileObject.Kind kind, FileObject fo )
{
  String name = fo == null ? null : fo.getName();
  return name != null && name.contains( "_Manifold_Temp_Main_" );
}