當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。