本文整理汇总了Java中org.openide.filesystems.FileSystem.refresh方法的典型用法代码示例。如果您正苦于以下问题:Java FileSystem.refresh方法的具体用法?Java FileSystem.refresh怎么用?Java FileSystem.refresh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.filesystems.FileSystem
的用法示例。
在下文中一共展示了FileSystem.refresh方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import org.openide.filesystems.FileSystem; //导入方法依赖的package包/类
/**
* Sets up the testing environment by creating testing folders
* on the system file system.
*/
@Override
protected void setUp() throws Exception {
clearWorkDir();
MockLookup.setInstances(
new Repository(TestUtilHid.createLocalFileSystem(getWorkDir(), new String[0])),
new Pool());
MyDL loader = MyDL.getLoader(MyDL.class);
FileSystem dfs = FileUtil.getConfigRoot().getFileSystem();
dfs.refresh (true);
root = FileUtil.createFolder (dfs.getRoot (), loader.actionsContext ());
FileObject fo = FileUtil.createData (dfs.getRoot (), "a.txt");
obj = DataObject.find (fo);
assertEquals ("The correct loader", loader, obj.getLoader ());
node = obj.getNodeDelegate ();
}
示例2: setUp
import org.openide.filesystems.FileSystem; //导入方法依赖的package包/类
/**
* Sets up the testing environment by creating testing folders
* on the system file system.
*/
@Override
protected void setUp() throws Exception {
clearWorkDir();
MockLookup.setInstances(
new Repository(TestUtilHid.createLocalFileSystem(getWorkDir(), new String[0])),
new Pool());
MyDL loader = MyDL.getLoader(MyDL.class);
FileSystem dfs = FileUtil.getConfigRoot().getFileSystem();
dfs.refresh (true);
FileObject fo = FileUtil.createData (dfs.getRoot (), "a.txt");
obj = DataObject.find (fo);
assertEquals ("The correct loader", loader, obj.getLoader ());
node = obj.getNodeDelegate ();
sfs = new PCL ();
dfs.addFileChangeListener (sfs);
}
示例3: setUp
import org.openide.filesystems.FileSystem; //导入方法依赖的package包/类
/**
* Sets up the testing environment by creating testing folders
* on the system file system.
*/
@Override
protected void setUp() throws Exception {
clearWorkDir();
MockLookup.setInstances(new Repository(TestUtilHid.createLocalFileSystem(getWorkDir(), new String[0])),
new Pool());
MyDL1 loader1 = MyDL1.getLoader(MyDL1.class);
MyDL2 loader2 = MyDL2.getLoader(MyDL2.class);
FileSystem dfs = FileUtil.getConfigRoot().getFileSystem();
dfs.refresh (true);
FileObject fo = FileUtil.createData (dfs.getRoot (), "a.ext1");
obj1 = DataObject.find (fo);
assertEquals ("The correct loader", loader1, obj1.getLoader ());
fo = FileUtil.createData (dfs.getRoot (), "b.ext2");
obj2 = DataObject.find (fo);
assertEquals ("The correct loader", loader2, obj2.getLoader ());
sfs = new PCL ();
dfs.addFileChangeListener (sfs);
}
示例4: testRefresh109490
import org.openide.filesystems.FileSystem; //导入方法依赖的package包/类
public void testRefresh109490() throws Exception {
final File wDir = getWorkDir();
final FileObject wDirFo = FileBasedFileSystem.getFileObject(wDir);
final List<FileEvent> fileEvents = new ArrayList<FileEvent>();
FileSystem fs = wDirFo.getFileSystem();
FileChangeListener fListener = new FileChangeAdapter() {
@Override
public void fileDataCreated(FileEvent fe) {
super.fileDataCreated(fe);
fileEvents.add(fe);
}
};
try {
fs.addFileChangeListener(fListener);
File file = new File(wDir, "testao.f");
File file2 = new File(wDir, "testc1.f");
assertEquals(file.hashCode(), file2.hashCode());
wDirFo.getChildren();
assertTrue(file.createNewFile());
assertTrue(file2.createNewFile());
assertEquals(0, fileEvents.size());
fs.refresh(true);
assertEquals(2, fileEvents.size());
assertEquals(Arrays.asList(wDirFo.getChildren()).toString(), 2,wDirFo.getChildren().length);
assertTrue(Arrays.asList(wDirFo.getChildren()).toString().indexOf(file.getName()) != -1);
assertTrue(Arrays.asList(wDirFo.getChildren()).toString().indexOf(file2.getName()) != -1);
} finally {
fs.removeFileChangeListener(fListener);
}
}
示例5: testRefresh109490
import org.openide.filesystems.FileSystem; //导入方法依赖的package包/类
public void testRefresh109490() throws Exception {
final File wDir = new File(getWorkDir(), getName());
wDir.mkdir();
final FileObject wDirFo = FileUtil.toFileObject(wDir);
final List<FileEvent> fileEvents = new ArrayList<FileEvent>();
FileSystem fs = wDirFo.getFileSystem();
FileChangeListener fListener = new FileChangeAdapter(){
@Override
public void fileDataCreated(FileEvent fe) {
super.fileDataCreated(fe);
fileEvents.add(fe);
}
};
try {
fs.refresh(true); // catch and skip changes made in VCS metadata, they are not part of this test
fs.addFileChangeListener(fListener);
File file = new File(wDir, "testao.f");
File file2 = new File(wDir, "testc1.f");
assertEquals(file.hashCode(), file2.hashCode());
wDirFo.getChildren();
assertTrue(file.createNewFile());
assertTrue(file2.createNewFile());
assertEquals(0, fileEvents.size());
fs.refresh(true);
assertEquals(2, fileEvents.size());
assertEquals(Arrays.asList(wDirFo.getChildren()).toString(), 2,wDirFo.getChildren().length);
assertTrue(Arrays.asList(wDirFo.getChildren()).toString().indexOf(file.getName()) != -1);
assertTrue(Arrays.asList(wDirFo.getChildren()).toString().indexOf(file2.getName()) != -1);
} finally {
fs.removeFileChangeListener(fListener);
}
}
示例6: run
import org.openide.filesystems.FileSystem; //导入方法依赖的package包/类
public void run() {
LOG.fine("start delete");
try {
fo.getFileSystem().addFileChangeListener(new DelFileChangeListener());
FileSystem fs = fo.getFileSystem();
FileUtil.toFile(fo).delete();
fs.refresh(true);
} catch (Exception e) {
e.printStackTrace();
}
LOG.fine("end delete");
}
示例7: testRefreshDoesNotMultiplyFileObjects_89059
import org.openide.filesystems.FileSystem; //导入方法依赖的package包/类
public void testRefreshDoesNotMultiplyFileObjects_89059 () throws Exception {
FileObject fo = FileBasedFileSystem.getFileObject(testFile);
fo.getChildren();
FileSystem fs = fo.getFileSystem();
FileChangeListener fcl = new FileChangeAdapter();
OutputStream os = null;
fs.addFileChangeListener(fcl);
fo.addFileChangeListener(fcl);
try {
//no change
int foInstancesInCache = Statistics.fileObjects();
fs.refresh(false);
assertTrue(foInstancesInCache >= Statistics.fileObjects());
//internal change
File ff = new File(testFile,"a/b/c/d/aa.txt");//NOI18N
FileUtil.createData(ff);
foInstancesInCache = Statistics.fileObjects();
fs.refresh(false);
assertTrue(foInstancesInCache >= Statistics.fileObjects());
//external change
FileObject ffObject = FileBasedFileSystem.getFileObject(ff);
foInstancesInCache = Statistics.fileObjects();
os = new java.io.FileOutputStream(ff);
os.write("dsdopsdsd".getBytes());//NOI18N
os.close();
fs.refresh(false);
assertTrue(foInstancesInCache >= Statistics.fileObjects());
assertTrue(new File(testFile,"nfile").createNewFile());//NOI18N
fs.refresh(false);
fo.refresh(false);
assertTrue(foInstancesInCache+1 >= Statistics.fileObjects());
foInstancesInCache = Statistics.fileObjects();
assertTrue(new File(testFile,"aa/bb/cc").mkdirs());//NOI18N
fs.refresh(false);
fo.refresh(false);
assertTrue(foInstancesInCache+3 >= Statistics.fileObjects());
} finally {
if (os != null) {
os.close();
}
fs.removeFileChangeListener(fcl);
fo.removeFileChangeListener(fcl);
}
}
示例8: EventsEvaluator
import org.openide.filesystems.FileSystem; //导入方法依赖的package包/类
EventsEvaluator(FileSystem fs) throws FileStateInvalidException {
this.fs = fs;
fs.refresh(true);
fs.addFileChangeListener(this);
}