本文整理汇总了Java中org.openide.filesystems.FileObject.getFolders方法的典型用法代码示例。如果您正苦于以下问题:Java FileObject.getFolders方法的具体用法?Java FileObject.getFolders怎么用?Java FileObject.getFolders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.filesystems.FileObject
的用法示例。
在下文中一共展示了FileObject.getFolders方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scanForPackages
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
/**
* Scan recursively through all folders in the given <code>dir</code> and
* add every directory/package, which contains at least one file with the
* given extension (probably class or java), into the given
* <code>validPkgs</code> set. Added entries are in the form of regular java
* package (x.y.z)
*/
private static void scanForPackages(final Set<FileObject> validPkgs, final FileObject dir, final String ext) {
if (dir == null) {
return;
}
for (Enumeration en1 = dir.getFolders(false); en1.hasMoreElements(); ) {
FileObject subDir = (FileObject) en1.nextElement();
if (VisibilityQuery.getDefault().isVisible(subDir)) {
scanForPackages(validPkgs, subDir, ext);
}
}
for (Enumeration en2 = dir.getData(false); en2.hasMoreElements(); ) {
FileObject kid = (FileObject) en2.nextElement();
if (kid.hasExt(ext) && Utilities.isJavaIdentifier(kid.getName())) {
// at least one class inside directory -> valid package
validPkgs.add(dir);
break;
}
}
}
示例2: testGetInputStream
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
/**
* Test of getInputStream method, of class org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj.
*/
public void testGetInputStream() {
File f = testFile;
FileSystem fs = FileBasedFileSystem.getInstance();
FileObject root = fs.getRoot();
assertNotNull(root);
Enumeration<? extends FileObject> en = root.getFolders(true);
for (int i = 0; i < 10 && en.hasMoreElements(); i++) {
FileObject fo = (FileObject) en.nextElement();
assertTrue(fo.isFolder());
assertFalse(fo.isData());
try {
fo.getInputStream();
fail ();
} catch (FileNotFoundException e) {
}
}
}
示例3: testGetOutputStream
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
/**
* Test of getOutputStream method, of class org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj.
*/
public void testGetOutputStream() {
File f = testFile;
FileSystem fs = FileBasedFileSystem.getInstance();
FileObject root = fs.getRoot();
assertNotNull(root);
Enumeration<? extends FileObject> en = root.getFolders(true);
for (int i = 0; i < 10 && en.hasMoreElements(); i++) {
FileObject fo = (FileObject) en.nextElement();
assertTrue(fo.isFolder());
assertFalse(fo.isData());
try {
fo.getOutputStream(fo.lock());
fail ();
} catch (IOException e) {
} finally {
}
}
}
示例4: loadFromDefaultFileSystem
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
private void loadFromDefaultFileSystem() {
FileObject f = FileUtil.getConfigFile("SaaSServices"); // NOI18N
if (f != null && f.isFolder()) {
Enumeration<? extends FileObject> en = f.getFolders(false);
while (en.hasMoreElements()) {
FileObject groupFolder = en.nextElement();
for (FileObject fo : groupFolder.getChildren()) {
if (fo.isFolder()) {
continue;
}
if (PROFILE_PROPERTIES_FILE.equals(fo.getNameExt())) {
continue;
}
loadSaasServiceFile(fo, false);
}
SaasGroup g = rootGroup.getChildGroup(groupFolder.getName());
if (g != null) {
g.setIcon16Path((String) groupFolder.getAttribute("icon16"));
g.setIcon32Path((String) groupFolder.getAttribute("icon32"));
}
}
}
}
示例5: searchSources
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
@NonNull
private Collection<FileObject> searchSources(
@NonNull final FileObject root,
@NonNull final Collection<FileObject> result,
@NonNull final Request request,
@NonNull final List<SearchFilter> filters) {
if (isCancelled() ||
root.getChildren().length == 0 ||
request.isExcluded(root) ||
!checkAgainstFilters(root, filters)) {
return result;
} else {
result.add(root);
final Enumeration<? extends FileObject> subFolders = root.getFolders(false);
while (subFolders.hasMoreElements()) {
searchSources(subFolders.nextElement(), result, request, filters);
}
}
return result;
}
示例6: processFolderChildren
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
private void processFolderChildren(FileObject fo, Set<Project> projects, ProgressHandle h, Counter counter, boolean checkShare) throws IllegalArgumentException {
Enumeration<? extends FileObject> e = fo.getFolders(false);
while (e.hasMoreElements()) {
try {
FileObject em = e.nextElement();
SharabilityQuery.Sharability share = SharabilityQuery.Sharability.UNKNOWN;
if (checkShare) {
share = SharabilityQuery.getSharability(fo);
if (share == SharabilityQuery.Sharability.NOT_SHARABLE) {
continue;
}
}
Project p = ProjectManager.getDefault().findProject(em);
if (p != null && !ProjectConvertors.isConvertorProject(p)) {
projects.add(p);
if (h != null) {
h.progress(progressMessage(p), Math.min(++counter.start, counter.end));
}
}
checkShare = share != SharabilityQuery.Sharability.SHARABLE;
// don't need to check the sharability if the current folder is marked as recursively sharable
processFolderChildren(em, projects, h, counter, checkShare);
} catch (IOException x) {
Exceptions.printStackTrace(x);
}
}
}
示例7: processFolder
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
private static void processFolder(FileObject file, NameObtainer nameObtainer, SortedSet<String> result, boolean onlyRoots) {
Enumeration<? extends FileObject> dataFiles = file.getData(false);
Enumeration<? extends FileObject> folders = file.getFolders(false);
if (dataFiles.hasMoreElements()) {
while (dataFiles.hasMoreElements()) {
FileObject kid = dataFiles.nextElement();
if ((kid.hasExt("java") || kid.hasExt("class")) && Utilities.isJavaIdentifier(kid.getName())) {
// at least one java or class inside directory -> valid package
String packageName = nameObtainer.getPackageName(file);
if (packageName == null) {
continue;
}
result.add(packageName);
if (onlyRoots) {
// don't recurse into subfolders
return;
} else {
// recurse inot subfolders
break;
}
}
}
}
while (folders.hasMoreElements()) {
processFolder(folders.nextElement(), nameObtainer, result, onlyRoots);
}
}
示例8: instantiateNEW
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
public Set/*<FileObject>*/ instantiateNEW(/*ProgressHandle handle*/) throws IOException {
Set<FileObject> resultSet = new LinkedHashSet<FileObject>();
File dirF = FileUtil.normalizeFile((File) wiz.getProperty("projdir"));
dirF.mkdirs();
FileObject template = Templates.getTemplate(wiz);
FileObject dir = FileUtil.toFileObject(dirF);
unZipFile(template.getInputStream(), dir);
substituteFiles(dirF);
// Always open top dir as a project:
resultSet.add(dir);
// Look for nested projects to open as well:
Enumeration<? extends FileObject> e = dir.getFolders(true);
while (e.hasMoreElements()) {
FileObject subfolder = e.nextElement();
if (ProjectManager.getDefault().isProject(subfolder)) {
resultSet.add(subfolder);
}
}
File parent = dirF.getParentFile();
if (parent != null && parent.exists()) {
ProjectChooser.setProjectsFolder(parent);
}
return resultSet;
}
示例9: instantiate
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
public Set/*<FileObject>*/ instantiate(/*ProgressHandle handle*/) throws IOException {
Set<FileObject> resultSet = new LinkedHashSet<FileObject>();
File dirF = FileUtil.normalizeFile((File) wiz.getProperty("projdir"));
dirF.mkdirs();
FileObject template = Templates.getTemplate(wiz);
FileObject dir = FileUtil.toFileObject(dirF);
unZipFile(template.getInputStream(), dir);
substituteFiles(dirF);
// Always open top dir as a project:
resultSet.add(dir);
// Look for nested projects to open as well:
Enumeration<? extends FileObject> e = dir.getFolders(true);
while (e.hasMoreElements()) {
FileObject subfolder = e.nextElement();
if (ProjectManager.getDefault().isProject(subfolder)) {
resultSet.add(subfolder);
}
}
File parent = dirF.getParentFile();
if (parent != null && parent.exists()) {
ProjectChooser.setProjectsFolder(parent);
}
return resultSet;
}
示例10: instantiate
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
@Override
public Set/*<FileObject>*/ instantiate(/*ProgressHandle handle*/) throws IOException {
Set<FileObject> resultSet = new LinkedHashSet<>();
File dirF = FileUtil.normalizeFile((File) wiz.getProperty("projdir"));
dirF.mkdirs();
FileObject template = Templates.getTemplate(wiz);
FileObject dir = FileUtil.toFileObject(dirF);
unZipFile(template.getInputStream(), dir);
// Always open top dir as a project:
resultSet.add(dir);
// Look for nested projects to open as well:
Enumeration<? extends FileObject> e = dir.getFolders(true);
while (e.hasMoreElements()) {
FileObject subfolder = e.nextElement();
if (ProjectManager.getDefault().isProject(subfolder)) {
resultSet.add(subfolder);
}
}
File parent = dirF.getParentFile();
if (parent != null && parent.exists()) {
ProjectChooser.setProjectsFolder(parent);
}
return resultSet;
}
示例11: processSubfolders
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
private void processSubfolders(FileObject dtdFolder) {
for (Enumeration en = dtdFolder.getFolders(false); en.hasMoreElements();) {
FileObject folder = (FileObject) en.nextElement();
addFolder(folder);
}
}