protected void computeFQNs(final Map<JavaFileObject, List<String>> file2FQNs, CompilationUnitTree cut, CompileTuple tuple) { String pack; if (cut.getPackageName() != null) { pack = cut.getPackageName().toString() + "."; //XXX } else { pack = ""; } String path = tuple.indexable.getRelativePath(); int i = path.lastIndexOf('.'); if (i >= 0) path = path.substring(0, i); path = FileObjects.convertFolder2Package(path); List<String> fqns = new LinkedList<String>(); boolean hasClassesLivingElsewhere = false; for (Tree t : cut.getTypeDecls()) { if (TreeUtilities.CLASS_TREE_KINDS.contains(t.getKind())) { String fqn = pack + ((ClassTree) t).getSimpleName().toString(); fqns.add(fqn); if (!path.equals(fqn)) { hasClassesLivingElsewhere = true; } } } if (hasClassesLivingElsewhere) { file2FQNs.put(tuple.jfo, fqns); } }
void addRequire(IndexDocument document) { // Don't generate "require" clauses for anything in generated ruby; // these classes are all built in and do not require any includes // (besides, the file names are bogus - they are just derived from // the class name by the stub generator) String folder = (file.getParent() != null) && file.getParent().getParent() != null ? file.getParent().getParent().getNameExt() : ""; if (folder.equals(RubyPlatform.RUBYSTUBS) && file.getName().startsWith("stub_")) { return; } // Index for require-completion String relative = indexable.getRelativePath(); if (relative != null) { if (relative.endsWith(".rb")) { // NOI18N relative = relative.substring(0, relative.length() - 3); document.addPair(FIELD_REQUIRE, relative, true, true); } } }
ext = FileObjects.RS; String relativePath = tuple.indexable.getRelativePath(); javax.tools.FileObject fo = manager.getFileForOutput(StandardLocation.CLASS_OUTPUT, "", FileObjects.stripExtension(relativePath) + '.' + ext, tuple.jfo); assert fo != null;
@Override protected void index(Iterable<? extends Indexable> files, Context context) { if (!CndTraceFlags.USE_INDEXING_API) { return; } // for now we're not interested in such events (project open for example) if (context.isAllFilesIndexing()) { return; } FileObject root = context.getRoot(); for (Indexable idx : files) { final FileObject fo = root.getFileObject(idx.getRelativePath()); if (delegate != null) { delegate.index(fo); } } }
final FileObject resource = srcPath.findResource(i.getRelativePath()); if (resource == null) { LOG.log(
final File classFolder = JavaIndex.getClassFolder(context); final File aptFolder = JavaIndex.getAptFolder(context.getRootURI(), false); final String sourceRelative = indexable.getRelativePath(); final List<Pair<String,URL>> sourceRelativeURLPairs = new LinkedList<Pair<String,URL>>(); sourceRelativeURLPairs.add(Pair.of(sourceRelative,indexable.getURL()));
/** * Creates {@link File} based {@link JavaFileObject} for {@link Indexable}. * @param indexable for which the {@link JavaFileObject} should be created * @param root - the classpath root owning the file * @param encoding - the file's encoding * @return {@link JavaFileObject}, never returns null */ @NonNull public static PrefetchableJavaFileObject fileFileObject( @NonNull final Indexable indexable, @NonNull final File root, @NullAllowed final JavaFileFilterImplementation filter, @NullAllowed final Charset encoding) throws IOException { assert indexable != null; assert root != null; final String[] pkgNamePair = getFolderAndBaseName( indexable.getRelativePath(), NBFS_SEPARATOR_CHAR); try { final File file = BaseUtilities.toFile(indexable.getURL().toURI()); return new FileBase( file, convertFolder2Package(pkgNamePair[0]), pkgNamePair[1], filter, encoding); } catch (URISyntaxException use) { throw new IOException(use); } }