@Override public IDirectory dir(String relativePath) { return _delegate.dir(relativePath); }
protected IDirectory getIResourceFromJarDirectoryAndEntryName(IDirectory jarFS, String entryName) { return jarFS.dir(entryName); }
protected IDirectory getIResourceFromJarDirectoryAndEntryName(IDirectory jarFS, String entryName) { return jarFS.dir(entryName); }
private static IDirectory findParentDirectory(IDirectory root, List<String> relativePath) { IDirectory parent = root; for (String pathComponent : relativePath) { if (pathComponent.equals(".")) { // Do nothing } else if (pathComponent.equals("..")) { parent = parent.getParent(); } else { parent = parent.dir(pathComponent); } } return parent; }
private static IDirectory findParentDirectory(IDirectory root, List<String> relativePath) { IDirectory parent = root; for (String pathComponent : relativePath) { if (pathComponent.equals(".")) { // Do nothing } else if (pathComponent.equals("..")) { parent = parent.getParent(); } else { parent = parent.dir(pathComponent); } } return parent; }
private IDirectory getDir(IFileSystemGosuClassRepository.ClassPathEntry root) { return _strFullPackageName.isEmpty() ? root.getPath() : root.getPath().dir(_strFullPackageName.replace('.', File.separatorChar)); }
private IDirectory getDir(IFileSystemGosuClassRepository.ClassPathEntry root) { return _strFullPackageName.isEmpty() ? root.getPath() : root.getPath().dir(_strFullPackageName.replace('.', File.separatorChar)); }
public Set<TypeName> getTypeNames(Set<String> extensions, ITypeLoader loader) { Set<TypeName> names = new HashSet<TypeName>(); for (PackageToClassPathEntryTreeMap child : _children.values()) { String name = child._strFullPackageName; name = name.substring(name.lastIndexOf('.') + 1); names.add(new TypeName(name, loader, TypeName.Kind.NAMESPACE, TypeName.Visibility.PUBLIC)); } for (IFileSystemGosuClassRepository.ClassPathEntry classPathEntry : _classPathEntries) { IDirectory entryPath = classPathEntry.getPath().dir(_strFullPackageName.replace('.', '/')); List<? extends IFile> files = entryPath.listFiles(); for (IFile file : files) { String extension = "." + file.getExtension(); if (extensions.contains(extension)) { String fqn = entryPath.relativePath(file).replace('/', '.'); fqn = fqn.substring(0, fqn.lastIndexOf('.')); names.add(new TypeName(_strFullPackageName + "." + fqn, loader, TypeName.Kind.TYPE, TypeName.Visibility.PUBLIC)); } } } return names; } }
public Set<TypeName> getTypeNames(Set<String> extensions, ITypeLoader loader) { Set<TypeName> names = new HashSet<TypeName>(); for (PackageToClassPathEntryTreeMap child : _children.values()) { String name = child._strFullPackageName; name = name.substring(name.lastIndexOf('.') + 1); names.add(new TypeName(name, loader, TypeName.Kind.NAMESPACE, TypeName.Visibility.PUBLIC)); } for (IFileSystemGosuClassRepository.ClassPathEntry classPathEntry : _classPathEntries) { IDirectory entryPath = classPathEntry.getPath().dir(_strFullPackageName.replace('.', '/')); List<? extends IFile> files = entryPath.listFiles(); for (IFile file : files) { String extension = "." + file.getExtension(); if (extensions.contains(extension)) { String fqn = entryPath.relativePath(file).replace('/', '.'); fqn = fqn.substring(0, fqn.lastIndexOf('.')); names.add(new TypeName(_strFullPackageName + "." + fqn, loader, TypeName.Kind.TYPE, TypeName.Visibility.PUBLIC)); } } } return names; } }
/** * Reads a pom.xml file into a GosuPathEntry object * * @param moduleFile the pom.xml file to convert to GosuPathEntry * @return an ordered list of GosuPathEntries created based on the algorithm described above */ public static GosuPathEntry createPathEntryForModuleFile(IFile moduleFile) { try { InputStream is = moduleFile.openInputStream(); try { SimpleXmlNode moduleNode = SimpleXmlNode.parse(is); IDirectory rootDir = moduleFile.getParent(); List<IDirectory> sourceDirs = new ArrayList<IDirectory>(); for (String child : new String[] { "gsrc", "gtest" }) { IDirectory dir = rootDir.dir(child); if (dir.exists()) { sourceDirs.add(dir); } } return new GosuPathEntry(rootDir, sourceDirs); } finally { is.close(); } } catch (IOException e) { throw new RuntimeException(e); } } }
/** * Reads a pom.xml file into a GosuPathEntry object * * @param moduleFile the pom.xml file to convert to GosuPathEntry * @return an ordered list of GosuPathEntries created based on the algorithm described above */ public static GosuPathEntry createPathEntryForModuleFile(IFile moduleFile) { try { InputStream is = moduleFile.openInputStream(); try { SimpleXmlNode moduleNode = SimpleXmlNode.parse(is); IDirectory rootDir = moduleFile.getParent(); List<IDirectory> sourceDirs = new ArrayList<IDirectory>(); for (String child : new String[] { "gsrc", "gtest" }) { IDirectory dir = rootDir.dir(child); if (dir.exists()) { sourceDirs.add(dir); } } return new GosuPathEntry(rootDir, sourceDirs); } finally { is.close(); } } catch (IOException e) { throw new RuntimeException(e); } } }
private HashMap<String, IDirectory> getNonOverriddenCollectionPaths() { HashMap<String, IDirectory> map = new HashMap<String, IDirectory>(); List<Pair<String,IFile>> pairs = getModule().getFileRepository().findAllFilesByExtension(WSC_EXTENSION); for ( Pair<String, IFile> pair : pairs ) { IFile file = pair.getSecond(); IDirectory dir = file.getParent().dir(file.getBaseName()); String collectionPath = getCollectionPath(pair.getFirst()); if (!map.containsKey(collectionPath)) { map.put(collectionPath, dir); } } return map; }
public List<Pair<String, IFile>> findAllFilesByExtension(String extension) { List<Pair<String, IFile>> results = new ArrayList<Pair<String, IFile>>(); for (IDirectory dir : _module.getRoots()) { IDirectory configDir = dir.dir(IModule.CONFIG_RESOURCE_PREFIX); if (configDir.exists()) { addAllLocalResourceFilesByExtensionInternal(IModule.CONFIG_RESOURCE_PREFIX, configDir, extension, results); } } for (IDirectory sourceEntry : _module.getSourcePath()) { if (sourceEntry.exists() && !sourceEntry.getName().equals(IModule.CONFIG_RESOURCE_PREFIX)) { addAllLocalResourceFilesByExtensionInternal("", sourceEntry, extension, results); } } return results; }