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

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

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

FileUtil.weakFileChangeListener介绍

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

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-filesystems

@SuppressWarnings("deprecation")
Impl(FileObject obj) {
  if (ERR.isLoggable(Level.FINE)) ERR.log(Level.FINE, "MIMEResolverImpl.Impl.<init>({0})", obj);  // NOI18N
  state = DescParser.INIT;
  data = obj;
  data.addFileChangeListener(FileUtil.weakFileChangeListener(listener, data));
}

代码示例来源:origin: org.netbeans.api/org-openide-filesystems

private OverFiles(String path, List<FOItem> items, AbstractLookup lkp, AbstractLookup.Content cnt) {
  super(computeDelegates(path, items, lkp));
  this.path = path;
  this.lkp = lkp;
  this.content = cnt;
  this.content.setPairs(order(items));
  FileSystem fs = null;
  try {
    fs = FileUtil.getConfigRoot().getFileSystem();
  } catch (FileStateInvalidException ex) {
    Exceptions.printStackTrace(ex);
  }
  this.weakL = FileUtil.weakFileChangeListener(this, fs);
  fs.addFileChangeListener(weakL);
}

代码示例来源:origin: org.netbeans.api/org-openide-filesystems

foRoot.addFileChangeListener(FileUtil.weakFileChangeListener(fcl, foRoot));

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-j2eeserver

private void addFileListenerTo(FileObject fo) {
  FileChangeListener l = FileUtil.weakFileChangeListener(listener, fo);
  fileListeners.put(fo, l);
  fo.addFileChangeListener(l);
  
}

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

public CookieImpl(FileObject f) {
  //System.err.println("new CookieImpl for " + f);
  this.f = f;
  f.addFileChangeListener(FileUtil.weakFileChangeListener(this, f));
}
public TreeDocumentRoot getDocumentRoot() {

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

public BadgingSupport(FileSystem fs) {
  this.fs = fs;
  fileChangeListener = FileUtil.weakFileChangeListener(this, null);
  fs.addFileChangeListener(fileChangeListener);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-libs-freemarker

public MyTemplate(FileObject fo, String s, Reader r, Configuration c) throws IOException {
  super(s, r, c);
  if (fo != null) {
    fo.addFileChangeListener(FileUtil.weakFileChangeListener(this, fo));
  }
}

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

public FsTracker(FileSystem fs) {
  this.fs = fs;
  if (this.fs != null) {
    this.fs.addFileChangeListener(FileUtil.weakFileChangeListener(this, this.fs));
  }
}

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

/**
* @param df data folder to show
*/
private FolderList (FileObject folder, boolean attach) {
  this.folder = folder;
  if (attach) {
    // creates object that handles all elements in array and
    // assignes it to the
    folder.addFileChangeListener (org.openide.filesystems.FileUtil.weakFileChangeListener (this, folder));
  }
}

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

@Override
  public void run() {
    // listen to any relevant configuration file change:
    long start = System.currentTimeMillis();
    Project project = projectRef.get();
    if (project != null) {
      project.getProjectDirectory().addRecursiveListener(FileUtil.weakFileChangeListener(ModelUnit.this, project.getProjectDirectory()));
    }
    LOGGER.log(Level.FINE, "JSF''s ModelUnit ResursiveListener registration took {0}ms.", new Object[]{(System.currentTimeMillis() - start)});
  }
});

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-groovy-grailsproject

private void startFSListener () {
  try {
    FileSystem fs = projectDir.getFileSystem();
    fs.addFileChangeListener(FileUtil.weakFileChangeListener(this, fs));
  } catch (FileStateInvalidException x) {
    Exceptions.printStackTrace(x);
  }
}

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

CachedFileObject (FileObject fo) {
  fileObj = fo;
  lastModified = fileObj.lastModified();
  fileObj.addFileChangeListener (FileUtil.weakFileChangeListener (this , fileObj));
}

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

CachedFileObject (FileObject fo) {
  fileObj = fo;
  lastModified = fileObj.lastModified();
  fileObj.addFileChangeListener (FileUtil.weakFileChangeListener (this , fileObj));
}

代码示例来源:origin: dcaoyuan/nbscala

void startFSListener() {
  //Listener has to be started when the project's lookup is initialized
  try {
    FileSystem fs = project.getProjectDirectory().getFileSystem();
    // XXX would be more efficient to only listen while DO_DEPEND=false (though this is the default)
    fs.addFileChangeListener(FileUtil.weakFileChangeListener(modificationListener, fs));
  } catch (FileStateInvalidException x) {
    Exceptions.printStackTrace(x);
  }
}

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

private void attachListeners() {
  try {
    if (fclWeak == null) {
      FileSystem fs = project.getProjectDirectory().getFileSystem();
      fclWeak = FileUtil.weakFileChangeListener(fclStrong, fs);
      fs.addFileChangeListener(fclWeak);
    }
  } catch (FileStateInvalidException e) {
    assert false : e;
  }
}

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

private void attachListener() {
  FileObject sourcesDirectory = ProjectPropertiesSupport.getSourcesDirectory(project);
  if (sourcesDirectory == null) {
    // broken project
    return;
  }
  try {
    FileSystem fileSystem = sourcesDirectory.getFileSystem();
    fileSystem.addFileChangeListener(FileUtil.weakFileChangeListener(fileChangeListener, fileSystem));
  } catch (FileStateInvalidException exc) {
    LOGGER.log(Level.WARNING, exc.getMessage(), exc);
  }
}

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

private Manager() {
  configFolder = FileUtil.getConfigFile("CND/Extensions"); // NOI18N
  if (configFolder != null) {
    listener = new L();
    configFolder.addFileChangeListener(FileUtil.weakFileChangeListener(listener, configFolder));
    initialize(configFolder);
  } else {
    listener = null;
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-api-ejbmodule

private ServerResourceNode(DataFolder folderDo, Project project) throws DataObjectNotFoundException {
  // if lookup would be needed uncomment and use getLookup() method
  super(getDataFolderNode(folderDo, project), getDataFolderNodeChildren(folderDo));
  projectDirectoryListener = new ProjectDirectoryListener();
  if (LOG) {
    LOGGER.log(Level.FINE, "Adding file listener to " + project.getProjectDirectory()); // NOI18N
  }
  project.getProjectDirectory().addFileChangeListener(FileUtil.weakFileChangeListener(projectDirectoryListener, project.getProjectDirectory()));
  this.project = project;
}

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

/**
 * Construct the implementation.
 */
public JspSourcePathImplementation(AntProjectHelper helper, PropertyEvaluator eval) {
  assert helper != null;
  assert eval != null;
  this.helper = helper;
  this.evaluator = eval;
  eval.addPropertyChangeListener(WeakListeners.propertyChange(this, eval));
  FileObject projectDir = helper.getProjectDirectory();
  projectDirListener = new ProjectDirectoryListener();
  projectDir.addFileChangeListener(FileUtil.weakFileChangeListener(projectDirListener, projectDir));
}

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

public void run() {
  computeKeys();
  refreshKeys();
  try { 
    FileSystem fs = root.getFileSystem();
    wfcl = FileUtil.weakFileChangeListener(this, fs);
    fs.addFileChangeListener( wfcl );
  }
  catch ( FileStateInvalidException e ) {
    Exceptions.printStackTrace(e);
  }
  wvqcl = WeakListeners.change( this, VisibilityQuery.getDefault() );
  VisibilityQuery.getDefault().addChangeListener( wvqcl );
}

相关文章