org.openide.filesystems.FileUtil.weakFileStatusListener()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中org.openide.filesystems.FileUtil.weakFileStatusListener()方法的一些代码示例,展示了FileUtil.weakFileStatusListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.weakFileStatusListener()方法的具体详情如下:
包路径:org.openide.filesystems.FileUtil
类名称:FileUtil
方法名:weakFileStatusListener

FileUtil.weakFileStatusListener介绍

[英]Creates a weak implementation of FileStatusListener.
[中]创建FileStatusListener的弱实现。

代码示例

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-project

FileStatusListener fsl = FileUtil.weakFileStatusListener(this, fs);
fs.addFileStatusListener(fsl);
fileSystemListeners.put(fs, fsl);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-ruby-railsprojects

FileStatusListener fsl = FileUtil.weakFileStatusListener(this, fs);
fs.addFileStatusListener(fsl);
fileSystemListeners.put(fs, fsl);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-clientproject

protected final void setFiles(final Set<FileObject> files) {
  fileSystemListeners = new HashSet<>();
  this.files = files;
  if (files == null) {
    return;
  }
  Set<FileSystem> hookedFileSystems = new HashSet<>();
  for (FileObject fo: files) {
    try {
      FileSystem fs = fo.getFileSystem();
      if (hookedFileSystems.contains(fs)) {
        continue;
      }
      hookedFileSystems.add(fs);
      FileStatusListener fsl = FileUtil.weakFileStatusListener(this, fs);
      fs.addFileStatusListener(fsl);
      fileSystemListeners.add(fsl);
    } catch (FileStateInvalidException e) {
      ErrorManager err = ErrorManager.getDefault();
      err.annotate(e, "Cannot get " + fo + " filesystem, ignoring...");  // NOI18N
      err.notify(ErrorManager.INFORMATIONAL, e);
    }
  }
}

代码示例来源:origin: org.codehaus.mevenide/nb-project

FileStatusListener fsl = FileUtil.weakFileStatusListener(this, fs);
fs.addFileStatusListener(fsl);
fileSystemListeners.put(fs, fsl);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject

protected final void setFiles(final Set<FileObject> files) {
  if (fs != null && fsl != null) {
    fs.removeFileStatusListener(fsl);
  }
  this.files = files;
  if (files == null) {
    return;
  }
  if (files.isEmpty()) {
    return;
  }
  FileObject fo = files.iterator().next();
  if (fo == null) {
    // See IZ 125880
    return;
  }
  try {
    fs = fo.getFileSystem();
    fsl = FileUtil.weakFileStatusListener(this, fs);
    fs.addFileStatusListener(fsl);
  } catch (FileStateInvalidException e) {
    ErrorManager err = ErrorManager.getDefault();
    err.annotate(e, "Cannot get " + fo + " filesystem, ignoring...");  // NOI18N
    err.notify(ErrorManager.INFORMATIONAL, e);
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide-loaders

/** Updates listening on a status of filesystem.
*/
private void updateStatusListener () {
  if (previous != null) {
    previous.removeFileStatusListener (weakL);
  }
  try {
    previous = obj.getPrimaryFile ().getFileSystem ();
    if (weakL == null) {
      weakL = org.openide.filesystems.FileUtil.weakFileStatusListener (this, null);
    }
    previous.addFileStatusListener (weakL);
  } catch (FileStateInvalidException ex) {
    previous = null;
  }
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-java-project-ui

private PackageRootNode( SourceGroup group, Children ch) {
  super(ch, new ProxyLookup(createLookup(group), Lookups.singleton(
      SearchInfoDefinitionFactory.createSearchInfoBySubnodes(ch))));
  this.group = group;
  file = group.getRootFolder();
  files = Collections.singleton(file);
  try {
    FileSystem fs = file.getFileSystem();
    fileSystemListener = FileUtil.weakFileStatusListener(this, fs);
    fs.addFileStatusListener(fileSystemListener);
  } catch (FileStateInvalidException e) {            
    Exceptions.printStackTrace(Exceptions.attachMessage(e,"Can not get " + file + " filesystem, ignoring...")); //NOI18N
  }
  setName( group.getName() );
  setDisplayName( group.getDisplayName() );        
  // setIconBase("org/netbeans/modules/java/j2seproject/ui/resources/packageRoot");
}

相关文章