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

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

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

FileUtil.removeFileChangeListener介绍

[英]Unregisters listener so that it will no longer receive FileEvents from FileSystems providing instances of FileObject convertible to java.io.File
[中]注销listener,使其不再从FileSystem接收FileEvents,从而提供可转换为java.io.FileFileObject实例

代码示例

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

private void unregisterFileSystemListener () {
  FileUtil.removeFileChangeListener(this);
}

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

private void updateListener(FileChangeListener listener, File oldDir, File newDir) {
  if (oldDir == null || !oldDir.equals(newDir)) {
    if (oldDir != null) {
      FileUtil.removeFileChangeListener(listener, oldDir);
    }
    if (newDir != null) {
      FileUtil.addFileChangeListener(listener, newDir);
    }
  }
}

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

private void updateListener(FileChangeListener listener, File oldDir, File newDir) {
    if (oldDir == null || !oldDir.equals(newDir)) {
      if (oldDir != null) {
        FileUtil.removeFileChangeListener(listener, oldDir);
      }
      if (newDir != null) {
        FileUtil.addFileChangeListener(listener, newDir);
      }
    }
  }
}

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

private synchronized void updateFileListeners(@NonNull final Collection<? extends File> newFiles) {
  final Collection<File> toAdd = new HashSet<>(newFiles);
  toAdd.removeAll(currentFiles);
  final Collection<File> toRemove = new HashSet<>(currentFiles);
  toRemove.removeAll(newFiles);
  for (File f : toRemove) {
    FileUtil.removeFileChangeListener(this, f);
  }
  for (File f : toAdd) {
    FileUtil.addFileChangeListener(this, f);
  }
  currentFiles.addAll(toAdd);
  currentFiles.removeAll(toRemove);
}

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

@Override
protected boolean removeFileChangeListenerImpl(FileChangeListener listener, FileSystem fileSystem, String path) {
  for (CndFileSystemProvider provider : cache) {
    if (provider.removeFileChangeListenerImpl(listener, fileSystem, path)) {
      return true;
    }
  }
  if (CndFileUtils.isLocalFileSystem(fileSystem)) {
    FileUtil.removeFileChangeListener(listener, FileUtil.normalizeFile(new File(path)));
    return true;
  } else {
    return false;
  }
}

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

@Override protected void removeNotify() {
  RepositoryPreferences.getInstance().removeChangeListener(this);
  removeChangeListener(this);
  if (addNotifyCalled) { //#213038
    try {
      FileUtil.removeFileChangeListener(this, MavenCli.DEFAULT_USER_SETTINGS_FILE);
    } catch (IllegalArgumentException exc) {
      //we just ignore, who cares
    }
    addNotifyCalled = false;
  }
}
@Override public void stateChanged(ChangeEvent e) {

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

public void cleanup() throws FileStateInvalidException {
  if (metaBase != null) {
    metaBase.getFileSystem().removeFileChangeListener(this);
  }
  if (resources != null) {
    FileUtil.removeFileChangeListener(this, resources);
    resources = null;
  }
  EjbJarProject.this.evaluator().removePropertyChangeListener(this);
}

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

public void attachListeners(BuildConfig config) {
  synchronized (GrailsCommandSupport.this) {
    // attach listener for global plugins
    File currentGlobalPluginsDir = config.getGlobalPluginsDir();
    updateListener(pluginListener, globalPluginsDir, currentGlobalPluginsDir);
    globalPluginsDir = currentGlobalPluginsDir;
    // if the directories are same we can't attach same listener twice
    File currentProjectPluginsDir = config.getProjectPluginsDir();
    if ((currentGlobalPluginsDir == null && currentGlobalPluginsDir == currentProjectPluginsDir)
        || currentGlobalPluginsDir.equals(currentProjectPluginsDir)) {
      if (projectPluginsDir != null) {
        FileUtil.removeFileChangeListener(pluginListener, projectPluginsDir);
      }
      projectPluginsDir = null;
      return;
    }
    // attach listener for project plugins
    updateListener(pluginListener, projectPluginsDir, currentProjectPluginsDir);
    projectPluginsDir = currentProjectPluginsDir;
  }
}

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

public void cleanup() throws FileStateInvalidException {
  if (docBase != null) {
    docBase.removeRecursiveListener(this);
  }
  if (webInf != null && !FileUtil.isParentOf(docBase, webInf)) {
    webInf.removeRecursiveListener(this);
  }
  if (resources != null) {
    FileUtil.removeFileChangeListener(this, resources);
    resources = null;
  }
  WebProject.this.evaluator().removePropertyChangeListener(this);
  webModule.getConfigSupport().removeDeployOnSaveListener(this);
}

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

public void initialize() throws FileStateInvalidException {
  EjbJarProject.this.evaluator().addPropertyChangeListener(this);
  
  if (!isCopyOnSaveEnabled()) {
    return;
  }
  
  metaBase = getEjbModule().getMetaInf();
  metaBaseValue = evaluator().getProperty(EjbJarProjectProperties.META_INF);
  if (resources != null) {
    FileUtil.removeFileChangeListener(this, resources);
  }
  resources = getEjbModule().getResourceDirectory();
  buildClasses = evaluator().getProperty(ProjectProperties.BUILD_CLASSES_DIR);
  if (metaBase != null) {
    metaBase.getFileSystem().addFileChangeListener(this);
  }
  if (resources != null) {
    FileUtil.addFileChangeListener(this, resources);
  }
  LOGGER.log(Level.FINE, "Meta directory is {0}", metaBaseValue);
}

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

public void initialize() throws FileStateInvalidException {
  WebProject.this.evaluator().addPropertyChangeListener(this);
  if (!isCopyOnSaveEnabled()) {
    return;
  }
  docBase = getWebModule().getDocumentBase();
  docBaseValue = evaluator().getProperty(WebProjectProperties.WEB_DOCBASE_DIR);
  webInf = getWebModule().getWebInf();
  webInfValue = evaluator().getProperty(WebProjectProperties.WEBINF_DIR);
  if (resources != null) {
    FileUtil.removeFileChangeListener(this, resources);
  }
  resources = getWebModule().getResourceDirectory();
  buildWeb = evaluator().getProperty(WebProjectProperties.BUILD_WEB_DIR);
  buildClasses = evaluator().getProperty("build.classes.dir");
  if (docBase != null) {
    docBase.addRecursiveListener(this);
  }
  if (webInf != null && !FileUtil.isParentOf(docBase, webInf)) {
    webInf.addRecursiveListener(this);
  }
  if (resources != null) {
    FileUtil.addFileChangeListener(this, resources);
  }
  // Add deployed resources notification listener
  webModule.getConfigSupport().addDeployOnSaveListener(this);
  LOGGER.log(Level.FINE, "Web directory is {0}", docBaseValue);
  LOGGER.log(Level.FINE, "WEB-INF directory is {0}", webInfValue);
}

相关文章