本文整理匯總了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);
}