本文整理汇总了Java中org.openide.filesystems.FileObject.isFolder方法的典型用法代码示例。如果您正苦于以下问题:Java FileObject.isFolder方法的具体用法?Java FileObject.isFolder怎么用?Java FileObject.isFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.filesystems.FileObject
的用法示例。
在下文中一共展示了FileObject.isFolder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displayNoOppositeLocationFound
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
/**
*/
@NbBundle.Messages({"# {0} - class",
"MSG_test_class_not_found=Test class for class {0} was not found.",
"# {0} - package",
"MSG_testsuite_class_not_found=Test class for package {0} was not found.",
"MSG_testsuite_class_not_found_def_pkg=Test class for the default package was not found."})
private void displayNoOppositeLocationFound() {
String sourceClsName;
FileObject fileObj = currLocation.getFileObject();
sourceClsName = srcClassPath.getResourceName(fileObj, '.', false);
// String msgKey = !fileObj.isFolder()
// ? "MSG_test_class_not_found" //NOI18N
// : (sourceClsName.length() != 0)
// ? "MSG_testsuite_class_not_found" //NOI18N
// : "MSG_testsuite_class_not_found_def_pkg";//NOI18N
// callback.foundLocation(currLocation.getFileObject(),
// new LocationResult(NbBundle.getMessage(getClass(), msgKey, sourceClsName)));
String error = !fileObj.isFolder()
? Bundle.MSG_test_class_not_found(sourceClsName)
: (sourceClsName.length() != 0)
? Bundle.MSG_testsuite_class_not_found(sourceClsName)
: Bundle.MSG_testsuite_class_not_found_def_pkg();
callback.foundLocation(currLocation.getFileObject(),
new LocationResult(error));
}
示例2: acceptTemplate
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
private boolean acceptTemplate (FileObject fo) {
if (fo.isFolder() &&
(TEMPLATES_FOLDER+"/Properties").equals(fo.getPath())) {
return false;
}
boolean attachListener;
synchronized (filesWeListenOn) {
attachListener = filesWeListenOn.add(fo);
}
if (attachListener) {
FileChangeListener fileChangeListener = FileUtil.weakFileChangeListener(this, fo);
fo.addFileChangeListener(fileChangeListener);
}
if (isTemplate (fo) || fo.isFolder()) {
Object o = fo.getAttribute ("simple"); // NOI18N
return o == null || Boolean.TRUE.equals (o);
} else {
return false;
}
}
示例3: addUsersFiles
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
private void addUsersFiles(FileObject mimeFolder, String profileId, boolean fullScan, Map<String, List<Object []>> files) {
if (profileId == null) {
FileObject settingHome = mimeFolder.getFileObject(settingTypeId);
if (settingHome != null && settingHome.isFolder()) {
if (isUsingProfiles) {
FileObject [] profileHomes = settingHome.getChildren();
for(FileObject f : profileHomes) {
if (f.isFolder()) {
String id = f.getNameExt();
addFiles(f, fullScan, files, id, f, false, false);
}
}
} else {
addFiles(settingHome, fullScan, files, null, null, false, false);
}
}
} else {
FileObject folder = mimeFolder.getFileObject(settingTypeId + "/" + profileId); //NOI18N
if (folder != null && folder.isFolder()) {
addFiles(folder, fullScan, files, profileId, folder, false, false);
}
}
}
示例4: loadFromWebServicesHome
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
private void loadFromWebServicesHome() {
for (FileObject fo : getWebServiceHome().getChildren()) {
if (!fo.isFolder()) {
continue;
}
for (FileObject file : fo.getChildren()) {
if (!file.getNameExt().endsWith("-saas.xml")) { //NOI18N
continue;
}
try {
loadSaasServiceFile(file, true);
} catch (Exception ex) {
Exceptions.printStackTrace(ex);
}
}
}
}
示例5: findJavadocRoots
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
/**
* Finds all javadoc roots under the given base folder.
* @param baseFolder the base folder to start search in; routine will traverse 5 folders
* @param canceled the canceling support
* @return the found javadoc roots
* @since 1.56
*/
@NonNull
public static Set<? extends FileObject> findJavadocRoots(
@NonNull final FileObject baseFolder,
@NullAllowed final AtomicBoolean canceled) {
Parameters.notNull("folder", baseFolder); //NOI18N
if (!baseFolder.isFolder()) {
throw new IllegalArgumentException ("baseFolder must be folder: " + baseFolder); //NOI18N
}
final Set<FileObject> result = new TreeSet<>((f1,f2) -> {
final String f1p = FileUtil.getRelativePath(baseFolder, f1);
final String f2p = FileUtil.getRelativePath(baseFolder, f2);
return f1p.compareTo(f2p);
});
findAllJavadocRoots(
baseFolder,
result,
canceled,
false,
0);
return Collections.unmodifiableSet(result);
}
示例6: refreshImpl
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
private synchronized void refreshImpl(FileObject file) {
LOG.log(Level.FINE, "refresh: {0}", file);
if (scope == null || callback == null)
return ; //nothing to refresh
if (!scope.isInScope(file)) {
if (!file.isFolder())
return;
//the given file may be a parent of some file that is in the scope:
for (FileObject inScope : scope.getLookup().lookupAll(FileObject.class)) {
if (FileUtil.isParentOf(file, inScope)) {
enqueue(new Work(inScope, callback));
}
}
return ;
}
LOG.log(Level.FINE, "enqueing work for: {0}", file);
enqueue(new Work(file, callback));
}
示例7: findTestSourcesFOs
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
@CheckForNull private FileObject[] findTestSourcesFOs(@NonNull Lookup context, boolean allowFolders, boolean strict) {
TYPE: for (String testType : project.supportedTestTypes()) {
FileObject testSrcDir = project.getTestSourceDirectory(testType);
if (testSrcDir != null) {
FileObject[] files = ActionUtils.findSelectedFiles(context, testSrcDir, null, strict);
if (files != null) {
for (FileObject file : files) {
if (!(file.hasExt("java") || allowFolders && file.isFolder())) {
break TYPE;
}
}
return files;
}
}
}
return null;
}
示例8: createInstance
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
@Override
public RefactoringPlugin createInstance(AbstractRefactoring refactoring) {
FileObject targetFile = refactoring.getRefactoringSource().lookup(FileObject.class);
NonRecursiveFolder pkg = refactoring.getRefactoringSource().lookup(NonRecursiveFolder.class);
TreePathHandle handle = refactoring.getRefactoringSource().lookup(TreePathHandle.class);
boolean folder = targetFile != null && targetFile.isFolder();
boolean javaPackage = pkg != null && RefactoringUtil.isOnSourceClasspath(pkg.getFolder());
boolean javaFile = targetFile != null && RefactoringUtil.isJavaFile(targetFile);
boolean javaMember = handle != null;
if (refactoring instanceof RenameRefactoring) {
RenameRefactoring rename = (RenameRefactoring) refactoring;
if (!javaFile && !(javaPackage || folder) && javaMember) {
return new RelationshipMappingRename(rename);
}
} else if (refactoring instanceof WhereUsedQuery) {
WhereUsedQuery whereUsedQuery = (WhereUsedQuery) refactoring;
return new RelationshipMappingWhereUsed(whereUsedQuery);
}
return null;
}
示例9: copySrcToDest
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
private static void copySrcToDest( FileObject srcFile, FileObject destFile) throws IOException {
if (destFile != null && !srcFile.isFolder()) {
InputStream is = null;
OutputStream os = null;
FileLock fl = null;
try {
is = srcFile.getInputStream();
fl = destFile.lock();
os = destFile.getOutputStream(fl);
FileUtil.copy(is, os);
} finally {
if (is != null) {
is.close();
}
if (os != null) {
os.close();
}
if (fl != null) {
fl.releaseLock();
}
}
}
}
示例10: createNodes
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
protected Node[] createNodes(Node n) {
DataObject dobj = (DataObject) n.getLookup().lookup(DataObject.class);
if (dobj != null) {
FileObject fobj = dobj.getPrimaryFile();
if (fobj.isFolder() && fobj.getNameExt().equals("nbproject") &&
fobj.getFileObject("project.xml") != null) {
// It is the NetBeans project folder, ignore it.
return new Node[0];
}
String fname = fobj.getNameExt();
String ext = decorator.getDocumentType();
if (fobj.isFolder() || fname.endsWith(ext)) {
return super.createNodes(n);
}
}
return new Node[0];
}
示例11: contains
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
@Override
public boolean contains(FileObject file) {
if (file != rootFolder && !FileUtil.isParentOf(rootFolder, file)) {
return false;
}
if (file.isFolder() && file != p.getProjectDirectory() && ProjectManager.getDefault().isProject(file)) {
// #67450: avoid actually loading the nested project.
return false;
}
if (FileOwnerQuery.getOwner(file) != p) {
return false;
}
// MIXED, UNKNOWN, and SHARABLE -> include it
return true; // SharabilityQuery.getSharability(file) != SharabilityQuery.Sharability.NOT_SHARABLE;
}
示例12: getShortDescription
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
public @Override String getShortDescription() {
FileObject folder = getOriginal().getLookup().lookup(FileObject.class);
if (folder != null && folder.isFolder()) {
try {
Project p = ProjectManager.getDefault().findProject(folder);
if (p != null) {
return ProjectUtils.getInformation(p).getDisplayName();
}
} catch (IOException x) {
LOG.log(Level.FINE, null, x);
}
}
return super.getShortDescription();
}
示例13: getClasses
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
/**
* Collects the names of the classes from the given folder, recursively if possible (i.e. the given
* folder is not a NonRecursiveFolder).
*
* @return a list of fully qualified names of the classes in the given folder and its subfolders.
*/
private List<String> getClasses(FileObject folder, List<String> result){
for (FileObject each : folder.getChildren()){
if (each.isFolder()){
getClasses(each, result);
} else {
result.add(JavaIdentifiers.getQualifiedName(each));
}
}
return result;
}
示例14: isValidSubtype
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
private static boolean isValidSubtype(FileObject subtypeFile) {
if (!subtypeFile.isFolder()) {
return false;
}
String typeName = subtypeFile.getNameExt();
return MimePath.validate(null, typeName) && !typeName.equals("base"); //NOI18N
}
示例15: getTempFolder
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
@Override
public FileObject getTempFolder() throws IOException {
FileObject tmpDir = FileUtil.toFileObject(new File(System.getProperty("java.io.tmpdir")));
if (tmpDir != null && tmpDir.isFolder() && tmpDir.isValid()) {
return tmpDir;
}
throw new IOException("Cannot find temporary folder"); // NOI18N
}