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


Java FileUtil.weakFileChangeListener方法代码示例

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


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

示例1: addCfgFileChangeListener

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
public static void addCfgFileChangeListener(Project prj, 
        FileChangeListener l){
    
    FileObject fo = getFOForBindingConfigFile(prj);
    FileChangeListener fcl = null;
    if (fo != null) {
        fcl = FileUtil.weakFileChangeListener(l, fo);
        fo.addFileChangeListener(fcl);
    } else {
        fo = getFOForNBProjectDir(prj);
        if (fo != null) {
            fcl = FileUtil.weakFileChangeListener(l, fo);                
            fo.addFileChangeListener(fcl);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ProjectHelper.java

示例2: acceptTemplate

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
private boolean acceptTemplate (FileObject fo) {
    if (fo.isFolder() &&
        (TEMPLATES_FOLDER+"/Properties").equals(fo.getPath())) {
        
        return false;
    }
    boolean attachListener;
    synchronized (filesWeListenOn) {
        attachListener = filesWeListenOn.add(fo);
    }
    if (attachListener) {
        FileChangeListener fileChangeListener = FileUtil.weakFileChangeListener(this, fo);
        fo.addFileChangeListener(fileChangeListener);
    }
    if (isTemplate (fo) || fo.isFolder()) {
        Object o = fo.getAttribute ("simple"); // NOI18N
        return o == null || Boolean.TRUE.equals (o);
    } else {
        return false;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:TemplatesPanel.java

示例3: run

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
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 );
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:PackageViewChildren.java

示例4: FileObjectCacheLine

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
FileObjectCacheLine(
        @NonNull final URL artefact,
        @NullAllowed final String modName,
        @NonNull final FileObject file) {
    super(artefact, modName);
    this.file = file;
    this.wl = FileUtil.weakFileChangeListener(this, this.file);
    this.file.addFileChangeListener(this.wl);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:ModuleNames.java

示例5: OverFiles

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
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.getSystemConfigRoot().getFileSystem();
    } catch (FileStateInvalidException ex) {
        Exceptions.printStackTrace(ex);
    }
    this.weakL = FileUtil.weakFileChangeListener(this, fs);
    fs.addFileChangeListener(weakL);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:RecognizeInstanceFiles.java

示例6: attachNotifier

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
/**
 * @param mfo FileObject from default file system
 * @param layer the layer where notifier will be searched on
 * @return true if attached notifier is the delegate FO
 */
private synchronized boolean attachNotifier (FileObject mfo, int layer) {
    FileSystem fsLayer = getLayer (layer);
    String fn = mfo.getPath();
    FileObject fo = null;
    boolean isDelegate = true;

    if (fsLayer == null)
        return false;

    // find new notifier - the FileObject with closest match to getFile ()
    while (fn.length () > 0 && null == (fo = fsLayer.findResource (fn))) {
        int pos = fn.lastIndexOf ('/');
        isDelegate = false;

        if (-1 == pos)
            break;
        
        fn = fn.substring (0, pos);
    }
    
    if (fo == null)
        fo = fsLayer.getRoot ();

    if (fo != notifiers [layer]) {
        // remove listener from existing notifier if any
        if (notifiers [layer] != null)
            notifiers [layer].removeFileChangeListener (weakL [layer]);

        // create new listener and attach it to new notifier
        weakL [layer] = FileUtil.weakFileChangeListener (this, fo);
        fo.addFileChangeListener (weakL [layer]);
        notifiers [layer] = fo;
    }
    
    return isDelegate;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:42,代码来源:FileStateManager.java

示例7: BadgingSupport

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
public BadgingSupport(FileSystem fs) {
    this.fs = fs;
    fileChangeListener = FileUtil.weakFileChangeListener(this, null);
    fs.addFileChangeListener(fileChangeListener);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:BadgingSupport.java

示例8: ConfigurationProviderImpl

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
public ConfigurationProviderImpl(
        @NonNull final Project p,
        @NonNull final PropertyEvaluator eval,
        @NonNull final UpdateHelper updateHelper,
        @NonNull final Set<String> configurationsAffectActions,
        @NullAllowed final Runnable customizerAction) {
    Parameters.notNull("p", p); //NOI18N
    Parameters.notNull("eval", eval);   //NOI18N
    Parameters.notNull("updateHelper", updateHelper);   //NOI18N
    Parameters.notNull("configurationsAffectActions", configurationsAffectActions); //NOI18N
    this.p = p;
    this.eval = eval;
    this.updateHelper = updateHelper;
    this.configurationsAffectActions = configurationsAffectActions;
    this.customizerAction = customizerAction;
    fclWeak = FileUtil.weakFileChangeListener(fcl, null);
    nbp = p.getProjectDirectory().getFileObject("nbproject"); // NOI18N
    if (nbp != null) {
        nbp.addFileChangeListener(fclWeak);
        LOGGER.log(Level.FINEST, "Added listener to {0}", nbp);
        configDir = nbp.getFileObject("configs"); // NOI18N
        if (configDir != null) {
            configDir.addFileChangeListener(fclWeak);
            LOGGER.log(Level.FINEST, "Added listener to {0}", configDir);
        }
    }
    eval.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(@NonNull final PropertyChangeEvent evt) {
            if (ProjectProperties.PROP_PROJECT_CONFIGURATION_CONFIG.equals(evt.getPropertyName())) {
                LOGGER.log(Level.FINER, "Refiring " + ProjectProperties.PROP_PROJECT_CONFIGURATION_CONFIG + " -> " + ProjectConfigurationProvider.PROP_CONFIGURATION_ACTIVE);
                Set<String> oldConfigs = configs != null ? configs.keySet() : Collections.<String>emptySet();
                calculateConfigs();
                Set<String> newConfigs = configs.keySet();
                if (!oldConfigs.equals(newConfigs)) {
                    LOGGER.log(Level.FINER, "Firing " + ProjectConfigurationProvider.PROP_CONFIGURATIONS + ": {0} -> {1}", new Object[] {oldConfigs, newConfigs});
                    pcs.firePropertyChange(ProjectConfigurationProvider.PROP_CONFIGURATIONS, null, null);
                }
                pcs.firePropertyChange(ProjectConfigurationProvider.PROP_CONFIGURATION_ACTIVE, null, null);
            }
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:44,代码来源:ProjectConfigurations.java

示例9: init

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
final void init() {
    weakListener = FileUtil.weakFileChangeListener(listener, folder);
    folder.getChildren();
    folder.addFileChangeListener(weakListener);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:ModuleList.java


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