本文整理汇总了Java中org.openide.filesystems.FileObject.removeFileChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java FileObject.removeFileChangeListener方法的具体用法?Java FileObject.removeFileChangeListener怎么用?Java FileObject.removeFileChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.filesystems.FileObject
的用法示例。
在下文中一共展示了FileObject.removeFileChangeListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: detach
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
public synchronized void detach() {
if (buildTask == null) {
return;
}
FileObject fo = listener.getFileObject();
fo.removeFileChangeListener(listener);
DockerSupport.getDefault().removeChangeListener(listener);
buildTask = null;
listener = null;
available = false;
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
setEnabled(false);
}
});
}
示例2: initActions
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
private void initActions (String folder, String category) {
if (loadedFromFolders != null) {
for (FileObject f : loadedFromFolders) {
f.removeFileChangeListener(weakFolderL);
}
}
FileObject fo = FileUtil.getConfigFile(folder);
if (fo == null) return;
DataFolder root = DataFolder.findFolder (fo);
if (loadedFromFolders == null) {
// the root must exist all the time, attach just once:
root.getPrimaryFile().addFileChangeListener(weakFolderL);
}
Enumeration<DataObject> en = root.children ();
Collection<FileObject> newFolders = new ArrayList<>(7);
while (en.hasMoreElements ()) {
DataObject dataObject = en.nextElement ();
if (dataObject instanceof DataFolder) {
initActions ((DataFolder) dataObject, null, category, newFolders);
}
}
this.loadedFromFolders = newFolders;
}
示例3: testRemoveListenerFromAFileObj
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
public void testRemoveListenerFromAFileObj() throws Exception {
File f = new File(new File(getWorkDir(), "dir"), "X.txt");
final File pf = f.getParentFile();
pf.mkdirs();
f.createNewFile();
FileObject fo = FileUtil.toFileObject(f);
assertTrue("Is data", fo.isData());
f.delete();
pf.delete();
FileObject parent = FileUtil.toFileObject(getWorkDir()).createData("dir");
assertTrue("Also data", parent.isData());
fo.removeFileChangeListener(new FileChangeAdapter());
}
示例4: invalidateGrammar
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
/**
* Notification from invalidator thread, the grammar need to be reloaded.
*/
public synchronized void invalidateGrammar() {
// make current loader a zombie
if (state == VALID) {
String msg = NbBundle.getMessage(GrammarManager.class, "MSG_loading_cancel");
StatusDisplayer.getDefault().setStatusText(msg);
}
doc.removeDocumentListener(this);
//remove FileChangeListeners from the external DTD files
for(FileObject fo : externalDTDs) {
// System.out.println("[GrammarManager] removed FileObjectListener from " + fo.getPath());
fo.removeFileChangeListener(this);
}
externalDTDs.clear();
guarded = new Position[0];
state = INVALID;
}
示例5: removeDeleteListener
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
@Override
public synchronized boolean removeDeleteListener(DeleteListener l) {
boolean removed = super.removeDeleteListener(l);
if (removed && getDeleteListeners().isEmpty() && projectDeleteListener != null) {
Project p = getProject(getURL());
if (p != null) {
FileObject projDir = p.getProjectDirectory();
projDir.removeFileChangeListener(projectDeleteListener);
projectDeleteListener = null;
}
}
return removed;
}
示例6: removeFileWatch
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
private void removeFileWatch(File file) {
FileObject fileo = null;
if (file.isFile())
fileo = FileUtil.toFileObject(FileUtil.normalizeFile(file));
if (fileo != null) {
FileWatch fileWatch = profilingPointsFiles.get(file);
if (fileWatch != null) {
fileWatch.decreaseReferences();
if (!fileWatch.hasReferences()) fileo.removeFileChangeListener(profilingPointsFiles.remove(file).getListener());
}
} else {
profilingPointsFiles.remove(file);
}
}
示例7: removeModelListner
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
public static void removeModelListner(Project prj, FileChangeListener l){
// WeakChangeListener will return true for its proxy.
FileObject fo = getFOForBindingConfigFile(prj);
if (fo != null) {
fo.removeFileChangeListener(l);
}
fo = getFOForNBProjectDir(prj);
if (fo != null) {
fo.removeFileChangeListener(l);
}
}
示例8: removeNotify
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
@Override
public void removeNotify() {
NbMavenProject watch = project.getLookup().lookup(NbMavenProject.class);
watch.removePropertyChangeListener(this);
watch.removeWatchedPath(MAIN); //NOI18N
watch.removeWatchedPath(TEST); //NOI18N
FileObject fo = project.getProjectDirectory().getFileObject(MAIN);
if (fo != null) {
fo.removeFileChangeListener(fcl);
}
fo = project.getProjectDirectory().getFileObject(TEST);
if (fo != null) {
fo.removeFileChangeListener(fcl);
}
}
示例9: checkFileObject
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
private void checkFileObject(String path) {
FileObject fo = project.getProjectDirectory().getFileObject(path);
if (fo != null) {
fo.removeFileChangeListener(fcl);
fo.addFileChangeListener(fcl);
}
}
示例10: testAsyncCall
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
public void testAsyncCall() throws Exception {
final FileObject workDirFo = FileBasedFileSystem.getFileObject(getWorkDir());
File f = new File(getWorkDir(), "a");
assertNull(workDirFo.getFileObject("a"));
assertTrue(f.createNewFile());
final Thread t = Thread.currentThread();
class FileChange extends FileChangeAdapter {
private boolean called = false;
@Override
public void fileDataCreated(FileEvent fe) {
assertNotSame(t, Thread.currentThread());
called = true;
synchronized (workDirFo) {
workDirFo.notifyAll();
}
}
public boolean isCalled() {
return called;
}
}
FileChange fcl = new FileChange();
workDirFo.addFileChangeListener(fcl);
try {
assertNotNull(FileUtil.toFileObject(f));
synchronized(workDirFo) {
workDirFo.wait();
}
assertNotNull(workDirFo.getFileObject("a"));
assertTrue(fcl.isCalled());
} finally {
workDirFo.removeFileChangeListener(fcl);
}
}
示例11: dispose
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
@Override
protected void dispose() {
super.dispose();
line.dispose();
FileObject fileObject = line.getFileObject();
if( fileObject != null ){
fileObject.removeFileChangeListener( myWeakListener );
myWeakListener = null;
}
}
示例12: refresh
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
/**
* Refresh the node, use information from a {@link Def} instance.
*/
public void refresh(Def def) {
refreshed = true; // ignore result set timestamp
this.charset = def.getCharset();
FileObject origFileObject = fileObject;
this.fileObject = def.getFileObject();
this.textDetails = def.getTextDetails();
dataObject = dataObject();
timestamp = fileObject.lastModified().getTime();
valid = (timestamp != 0L);
if (dataObject == null) {
return;
}
if (fileObject != origFileObject) {
if (fileListener != null) {
origFileObject.removeFileChangeListener(fileListener);
}
setUpDataObjValidityChecking();
}
nodeDelegate = dataObject.getNodeDelegate();
Mutex.EVENT.writeAccess(new Runnable() {
@Override
public void run() {
int origSelectedMatches = selectedMatchesCount;
selectedMatchesCount = 0;
if (textDetails != null && !textDetails.isEmpty()) {
adjustTextDetails();
}
changeSupport.firePropertyChange(PROP_MATCHES_SELECTED,
origSelectedMatches, selectedMatchesCount);
if (matchesCount > 0) {
setSelected(true);
}
InvalidityStatus origInvStat = invalidityStatus;
invalidityStatus = null;
changeSupport.firePropertyChange(PROP_INVALIDITY_STATUS,
origInvStat,
invalidityStatus);
}
});
}
示例13: testRefreshDoesNotMultiplyFileObjects_89059
import org.openide.filesystems.FileObject; //导入方法依赖的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);
}
}
示例14: testEventsAfterCreatedFiles55550
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
@RandomlyFails // NB-Core-Build #7927 (from FileBasedFileSystemWithUninitializedExtensionsTest): Didn't receive a FileEvent on the parent.
public void testEventsAfterCreatedFiles55550() throws Exception {
FileObject parent = root.getFileObject("testdir/mountdir8");
assertNotNull(parent);
assertTrue(parent.isFolder());
parent.getChildren();
File parentFile = FileUtil.toFile(parent);
assertNotNull(parentFile);
assertTrue(parentFile.getAbsolutePath(),parentFile.exists());
File newFile = new File(parentFile, "sun-web.xml");
assertFalse(newFile.getAbsolutePath(),newFile.exists());
class FCLImpl extends FileChangeAdapter {
boolean created;
@Override
public void fileDataCreated(FileEvent e) {
created = true;
synchronized(BaseFileObjectTestHid.this) {
BaseFileObjectTestHid.this.notifyAll();
}
}
}
FCLImpl fl = new FCLImpl();
parent.addFileChangeListener(fl);
assertTrue(newFile.getAbsolutePath(), newFile.createNewFile());
assertTrue(newFile.exists());
// !!!! This is the source of the problem !!!
// ask for the new file
// remove this line ans the test passes
FileUtil.toFileObject(newFile);
parent.refresh();
synchronized(this) {
wait(1000);
}
parent.removeFileChangeListener(fl);
assertTrue("Didn't receive a FileEvent on the parent.", fl.created);
}
示例15: testAddRemoveOnData
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
public void testAddRemoveOnData() throws IOException {
FileObject root = FileUtil.toFileObject(getWorkDir());
FileObject folder = root.createFolder("dir");
FileObject data = root.createData("data.txt");
notify.assertRegistered("No registered paths yet");
data.addFileChangeListener(listener);
root.addFileChangeListener(listener);
notify.assertRegistered("One path is being listened to", root.getPath());
data.removeFileChangeListener(listener);
notify.assertRegistered("Still one path is being listened to", root.getPath());
root.removeFileChangeListener(listener);
notify.assertRegistered("Path has been cleared", (String)null);
}