本文整理汇总了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);
}
}
}
示例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;
}
}
示例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 );
}
示例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);
}
示例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);
}
示例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;
}
示例7: BadgingSupport
import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
public BadgingSupport(FileSystem fs) {
this.fs = fs;
fileChangeListener = FileUtil.weakFileChangeListener(this, null);
fs.addFileChangeListener(fileChangeListener);
}
示例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);
}
}
});
}
示例9: init
import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
final void init() {
weakListener = FileUtil.weakFileChangeListener(listener, folder);
folder.getChildren();
folder.addFileChangeListener(weakListener);
}