当前位置: 首页>>代码示例>>Java>>正文


Java FileSystem.removeFileChangeListener方法代码示例

本文整理汇总了Java中org.openide.filesystems.FileSystem.removeFileChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java FileSystem.removeFileChangeListener方法的具体用法?Java FileSystem.removeFileChangeListener怎么用?Java FileSystem.removeFileChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openide.filesystems.FileSystem的用法示例。


在下文中一共展示了FileSystem.removeFileChangeListener方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testRefresh69744

import org.openide.filesystems.FileSystem; //导入方法依赖的package包/类
public void testRefresh69744() throws Exception {
    File thisTest = new File(getWorkDir(),"thisTest");
    thisTest.createNewFile();
    FileObject testf = FileBasedFileSystem.getFileObject(thisTest);
    assertNotNull(testf);
    assertGC("",new WeakReference<FileObject>(testf.getParent()));
    modifyFileObject(testf, "abc");
    FileSystem fs = testf.getFileSystem();
    final List<FileEvent> l = new ArrayList<FileEvent>();
    FileChangeListener fcl = new FileChangeAdapter() {
        @Override
        public void fileChanged(FileEvent fe) {
            l.add(fe);
        }
    };
    Thread.sleep(1500);
    fs.addFileChangeListener(fcl);
    try {
        modifyFileObject(testf, "def");
        assertFalse(l.isEmpty());
    } finally {
        fs.removeFileChangeListener(fcl);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:FolderObjTest.java

示例2: reset

import org.openide.filesystems.FileSystem; //导入方法依赖的package包/类
void reset() {
    Set filesystems = getRootFilesystems();
    for (Iterator i = filesystems.iterator(); i.hasNext();) {
        FileSystem fileSystem = (FileSystem) i.next();
        fileSystem.removeFileChangeListener(interceptor);
    }
    events.clear();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:DeleteCreateTestAnnotationProvider.java

示例3: 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);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:FolderObjTest.java

示例4: 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);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:BaseFileObjectTestHid.java

示例5: 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);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:49,代码来源:FolderObjTest.java


注:本文中的org.openide.filesystems.FileSystem.removeFileChangeListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。