本文整理汇总了Java中org.openide.filesystems.FileObject.addRecursiveListener方法的典型用法代码示例。如果您正苦于以下问题:Java FileObject.addRecursiveListener方法的具体用法?Java FileObject.addRecursiveListener怎么用?Java FileObject.addRecursiveListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.filesystems.FileObject
的用法示例。
在下文中一共展示了FileObject.addRecursiveListener方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
void init(Project p) {
Sources sources = ProjectUtils.getSources(p);
sources.addChangeListener(this);
SourceGroup[] groups = sources.getSourceGroups(Sources.TYPE_GENERIC);
roots = new FileObject[groups.length];
for (int i = 0; i < groups.length; i++) {
SourceGroup group = groups[i];
FileObject rootFolder = group.getRootFolder();
roots[i] = rootFolder;
rootFolder.addRecursiveListener(this);
//scan(rootFolder);
rootsToScan.add(rootFolder);
}
scanningTask = RP.post(this);
DependencyProjectProvider prov = p.getLookup().lookup(DependencyProjectProvider.class);
if (prov != null) {
projectDependencyManager = new ProjectDependencyManager(prov);
}
}
示例2: testRefreshRecursively
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
public void testRefreshRecursively() throws IOException {
File f = new File(dataRootDir, "workdir/root-test-versioned");
f.mkdirs();
FileObject fo = FileUtil.toFileObject(f);
fo = fo.createFolder("folder");
fo.addRecursiveListener(new FileChangeAdapter());
assertTrue(inteceptor.getRefreshRecursivelyFiles().contains(FileUtil.toFile(fo)));
}
示例3: testProvideExtensionsRefreshRecursively
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
public void testProvideExtensionsRefreshRecursively() throws Exception {
File root = new File(getWorkDir(), "root");
final File sub = new File(root, "sub");
final File subsub = new File(sub, "subsub");
File subsubdir = new File(subsub, "dir");
subsubdir.mkdirs();
File subfile = new File(sub, "file");
subfile.createNewFile();
File deepfile = new File(subsubdir, "deep");
deepfile.createNewFile();
ProvidedExtensionsTest.ProvidedExtensionsImpl.nextRefreshCall(
sub,
Long.MAX_VALUE - 10,
subfile
);
TestFileChangeListener fcl = new TestFileChangeListener();
FileObject rf = FileUtil.toFileObject(root);
rf.addRecursiveListener(fcl);
BaseFileObj noFO = FileObjectFactory.getInstance(root).getCachedOnly(subsubdir);
assertNull("subsub directory has been skipped", noFO);
assertEquals("No events", 0, fcl.checkAll());
LOG.log(Level.INFO, "Touching subfile: {0}", deepfile);
TestFileUtils.touch(deepfile, null);
LOG.log(Level.INFO, "Will do refresh, lastModified: {0}", deepfile.lastModified());
FileUtil.refreshFor(root);
LOG.info("Refresh done");
fcl.check(EventType.ATTRIBUTE_CHANGED); // ignore if any
fcl.printAll(LOG);
assertEquals("No other events", 0, fcl.checkAll());
}
示例4: testRefreshRecursively
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
public void testRefreshRecursively() throws IOException {
FileObject fo = getVersionedFolder();
fo = fo.createFolder("folder");
VCSFileProxy proxy = VCSFileProxy.createFileProxy(fo);
logHandler.clear();
fo.addRecursiveListener(new FileChangeAdapter());
assertTrue(inteceptor.getRefreshRecursivelyFiles().contains(VCSFileProxy.createFileProxy(fo)));
// XXX listFiles called twice on adding the listener. is this realy necessary
assertInterceptedCalls(
1, 2,
f(listFilesFormat, proxy)
);
}