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


Java FileUtil.removeFileChangeListener方法代码示例

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


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

示例1: clearReports

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
public void clearReports() {
    boolean hasAny;
    synchronized (reports) {
        hasAny = !reports.isEmpty();
        reports.clear();
        Iterator<File> as = missingArtifacts.iterator();
        while (as.hasNext()) {
            File f = as.next();
            if (f != null) {
                LOG.log(Level.FINE, "ceasing to listen to {0} from {1}", new Object[] {f, projectPOMFile});
                // a.getFile() should be normalized
                FileUtil.removeFileChangeListener(fcl, f);
                if (f.isFile()) {
                    BatchProblemNotifier.resolved(f);
                }
            }
            as.remove();
        }
        missingArtifacts.clear();
    }
    if (hasAny) {
        fireChange();
        firePropertyChange();
    }
    EmbedderFactory.getProjectEmbedder().lookupComponent(PluginArtifactsCache.class).flush(); // helps with #195440
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:ProblemReporterImpl.java

示例2: getBuildGeneratedDir

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
private File getBuildGeneratedDir() {
    final String buildGeneratedDirS = evaluator.getProperty(BUILD_GENERATED_DIR);
    final File _buildGeneratedDir = buildGeneratedDirS == null ? null : projectHelper.resolveFile(buildGeneratedDirS);
    synchronized (this) {
        if (_buildGeneratedDir == null || !_buildGeneratedDir.equals(buildGeneratedDir)) {
            if (buildGeneratedDir != null) {
                FileUtil.removeFileChangeListener(buildGeneratedDirListener, buildGeneratedDir);
            }
            buildGeneratedDir = _buildGeneratedDir;
            if (buildGeneratedDir != null) {
                FileUtil.addFileChangeListener(buildGeneratedDirListener, buildGeneratedDir);
            }
        }
        return buildGeneratedDir;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:SourcePathImplementation.java

示例3: invalidate

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
@Override
void invalidate() {
    super.invalidate();
    if (listens.compareAndSet(true, false)) {
        FileUtil.removeFileChangeListener(this, path);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:ModuleNames.java

示例4: computeModuleIfAbsent

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
@CheckForNull
private String computeModuleIfAbsent(
        @NonNull FileObject root,
        @NonNull final Function<FileObject,String> provider) {
    final Pair<Pair<Reference<FileObject>,File>,String> entry = modNameCache.get();
    FileObject owner;
    String modName;
    if (entry == null ||
            (owner = entry.first().first().get()) == null ||
            !owner.equals(root)) {
        modName = provider.apply(root);
        final File modInfo = Optional.ofNullable(FileUtil.toFile(root))
                .map((rf) -> new File(rf, String.format("%s.%s", FileObjects.MODULE_INFO, FileObjects.JAVA)))   //NOI18N
                .orElse(null);
        final Pair<Pair<Reference<FileObject>,File>,String> newEntry = Pair.of(
                Pair.of(new WeakReference<>(root), modInfo),
                modName);
        if (modNameCache.compareAndSet(entry, newEntry)) {
            if (entry != null && entry.first().second() != null) {
                FileUtil.removeFileChangeListener(this, entry.first().second());
            }
            if (newEntry.first().second() != null) {
                FileUtil.addFileChangeListener(this, newEntry.first().second());
            }
        }
        LOG.log(Level.FINE, "modNameCache updated: {0}", modName);  //NOI18N
    } else {
        modName = entry.second();
    }
    return modName;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:ModuleOraculum.java

示例5: changePersistenceScope

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
/**
 * Call this method in order to change the persistence scope returned by the
 * <code>PersistenceScopes</code> instance returned by {@link #getPersistenceScopes}
 * or the corresponding persistence.xml file.
 *
 * @param  newPersistenceScope the new persistence scope; can be null, but in this case
 *         the <code>newPersistenceXml</code> parameter must be null too.
 * @param  newPersistenceXml the new persistence.xml file; can be null.
 *
 * @throws IllegalArgumentException if <code>newPersistenceScope</code> is null
 *         and <code>newPersistenceXml</code> is not.
 */
public void changePersistenceScope(PersistenceScope newPersistenceScope, File newPersistenceXml) {
    if (newPersistenceScope == null && newPersistenceXml != null) {
        throw new IllegalArgumentException("The persistenceScope parameter cannot be null when newPersistenceXml is non-null"); // NOI18N
    }

    boolean oldPersistenceExists, newPersistenceExists;
    PersistenceScope oldPersistenceScope;

    synchronized (this) {
        oldPersistenceExists = persistenceExists;
        oldPersistenceScope = persistenceScope;

        LOG.fine("changePersistenceScope: newPersistenceXml=" + newPersistenceXml); // NOI18N

        if (persistenceXml != null) {
            FileUtil.removeFileChangeListener(fileChangeListener, persistenceXml);
        }
        if (newPersistenceXml != null) {
            persistenceXml = newPersistenceXml;
            FileUtil.addFileChangeListener(fileChangeListener, persistenceXml);
        } else {
            persistenceXml = null;
        }

        persistenceScope = newPersistenceScope;
        persistenceXml = newPersistenceXml;

        change();

        newPersistenceExists = persistenceExists;

        LOG.fine("changePersistenceScope: oldPersistenceExists=" + oldPersistenceExists + ", newPersistenceExists=" + newPersistenceExists); // NOI18N
    }

    if (oldPersistenceExists != newPersistenceExists || (oldPersistenceScope != newPersistenceScope && newPersistenceExists)) {
        LOG.fine("changePersistenceScope: firing PROP_PERSISTENCE_SCOPES change"); // NOI18N
        propChangeSupport.firePropertyChange(PersistenceScopes.PROP_PERSISTENCE_SCOPES, null, null);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:52,代码来源:PersistenceScopesHelper.java

示例6: removeWatchedPath

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
public void removeWatchedPath(URI uri) {
    //#110599
    boolean removeListener;
    File fil = Utilities.toFile(uri);
    synchronized (files) {
//#216001 addWatchedPath appeared to accumulate files forever on each project reload.
//that's because source roots get added repeatedly but never get removed and listening to changed happens elsewhere.
//the imagined fix for 216001 is to keep each item just once. That would break once multiple sources add a given file and one of them removes it
//as a hotfix this solution is ok, if we don't get some data updated, we should remove the watchedPath pattern altogether.
        removeListener = files.remove(fil);
    }
    if (removeListener) {
        FileUtil.removeFileChangeListener(listener, fil);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:NbMavenProject.java

示例7: removeCoordinates

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
private void removeCoordinates(FileEvent fe) {
    File file = FileUtil.toFile(fe.getFile());
    if(file != null) {
        synchronized(coorCache) {
            if(coorCache.remove(file) != null) {
                FileUtil.removeFileChangeListener(binaryChangeListener, file);
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:RepositoryForBinaryQueryImpl.java

示例8: removeChangeListener

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
@Override
public void removeChangeListener(ChangeListener l) {            
    synchronized (changeSupport) {
        final boolean hadListeners = changeSupport.hasListeners();
        changeSupport.removeChangeListener(l);            
        if (hadListeners ^ changeSupport.hasListeners())  {
            FileUtil.removeFileChangeListener(genSrcDirListener, genSrcDir);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:JavaSourceNodeFactory.java

示例9: removePropertyChangeListener

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
public void removePropertyChangeListener(@NonNull final PropertyChangeListener listener) {
    Parameters.notNull("listener", listener);   //NOI18N
    if (!state.compareAndSet(1, 2)) {
        throw new IllegalStateException("Already in state: " + state.get());    //NOI18N
    }
    support.removePropertyChangeListener(listener);
    for (File f : listensOn) {
        FileUtil.removeFileChangeListener(this, f);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:LibrariesNode.java

示例10: safeRemoveFileListener

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
private static void safeRemoveFileListener(
        @NonNull final File file,
        @NonNull final FileChangeListener listener) {
    try {
        FileUtil.removeFileChangeListener(listener, file);
    } catch (IllegalArgumentException e) {
        LOG.log(
                Level.WARNING,
                "Cannot remove listener from: {0}",     //NOI18N
                file);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:MultiModuleUnitTestsCompilerOptionsQueryImpl.java

示例11: recalcTarget

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
private void recalcTarget() {
    File target2 = findTarget(source.getFileObject());
    if (!BaseUtilities.compareObjects(target, target2)) {
        synchronized(targetListener) {
            // #45694: source file moved, recalculate target.
            if (target != null) {
                FileUtil.removeFileChangeListener(targetListener, target);
            }
            if (target2 != null) {
                FileUtil.addFileChangeListener(targetListener, target2);
            }
        }
        target = target2;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:GlobFileBuiltQuery.java

示例12: testNextEvent

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
/**
 * Test of nextEvent method, of class LinuxNotifier.
 *
 * @throws java.lang.Exception
 */
public void testNextEvent() throws Exception {

    if (Utilities.getOperatingSystem() != Utilities.OS_LINUX) {
        System.out.println("Skipping linux-only test: " + getName());
        return;
    }

    prepareFiles();

    final AtomicBoolean folder2refreshed = new AtomicBoolean(false);
    Logger log = Logger.getLogger(FolderObj.class.getName());

    Handler h = createHandler(folder2refreshed);
    log.addHandler(h);
    try {
        FileChangeListener l = new FileChangeAdapter();
        FileUtil.addFileChangeListener(l, folder1text1Txt);
        // This causes an IN_IGNORED native event.
        FileUtil.removeFileChangeListener(l, folder1text1Txt);
        // Native listeners may need some time.
        Thread.sleep(2000);
    } finally {
        log.removeHandler(h);
    }
    assertFalse("Folder folder2 should not be refreshed.",
            folder2refreshed.get());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:LinuxNotifier235632Test.java

示例13: safeRemoveFileChangeListener

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
private void safeRemoveFileChangeListener(@NonNull final File f) {
    try {
        FileUtil.removeFileChangeListener(this, f);
    } catch (IllegalArgumentException e) {
        //not important
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:J2SEActionProvider.java

示例14: safeRemoveFileChangeListener

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
private void safeRemoveFileChangeListener(@NonNull final File file) {
    try {
        FileUtil.removeFileChangeListener(this, file);
    } catch (IllegalArgumentException iae) {
        LOG.log(Level.FINE, iae.getMessage());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:ClassPath.java

示例15: resetModCache

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
private void resetModCache() {
    final Pair<Pair<Reference<FileObject>, File>, Boolean> entry = modCache.getAndSet(null);
    if (entry != null && entry.first().second() != null) {
        FileUtil.removeFileChangeListener(this, entry.first().second());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:DefaultSourceLevelQueryImpl.java


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