本文整理了Java中org.openide.filesystems.FileUtil.addFileChangeListener()
方法的一些代码示例,展示了FileUtil.addFileChangeListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.addFileChangeListener()
方法的具体详情如下:
包路径:org.openide.filesystems.FileUtil
类名称:FileUtil
方法名:addFileChangeListener
[英]Registers listener
so that it will receive FileEvent
s from FileSystem
s providing instances of FileObject
convertible to java.io.File
.
[中]注册listener
,以便从FileSystem
s接收FileEvent
s,提供可转换为java.io.File
的FileObject
实例。
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-clientproject
private void addFileChangeListener(File file) {
if (file == null) {
return;
}
try {
FileUtil.addFileChangeListener(fileChangesListener, file);
} catch (IllegalArgumentException ex) {
// already listenening, ignore
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-project
private void addFileChangeListener(File file) {
try {
FileUtil.addFileChangeListener(fileChangesListener, file);
} catch (IllegalArgumentException ex) {
// already listenening, ignore
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-clientproject
private void addFileChangeListener(File file) {
if (file == null) {
return;
}
try {
FileUtil.addFileChangeListener(fileChangesListener, file);
} catch (IllegalArgumentException ex) {
// already listenening, ignore
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-ruby-rakeproject
public FilePropertyProvider(File properties) {
this.properties = properties;
FileUtil.addFileChangeListener(this, properties);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-gsf
private void registerFileSystemListener () {
FileUtil.addFileChangeListener(this);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-ruby-rakeproject
private synchronized void listen(File rootLocation) {
// #40845. Need to fire changes if a source root is added or removed.
if (rootsListenedTo.add(rootLocation) && /* be lazy */ haveAttachedListeners) {
FileUtil.addFileChangeListener(this, rootLocation);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-ruby-rakeproject
public synchronized void addChangeListener(ChangeListener listener) {
if (!haveAttachedListeners) {
haveAttachedListeners = true;
for (File rootLocation : rootsListenedTo) {
FileUtil.addFileChangeListener(this, rootLocation);
}
}
cs.addChangeListener(listener);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-groovy-grailsproject
private void updateListener(FileChangeListener listener, File oldDir, File newDir) {
if (oldDir == null || !oldDir.equals(newDir)) {
if (oldDir != null) {
FileUtil.removeFileChangeListener(listener, oldDir);
}
if (newDir != null) {
FileUtil.addFileChangeListener(listener, newDir);
}
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-docker-api
private void init() {
FileUtil.addFileChangeListener(listener, getNewConfigFile());
FileUtil.addFileChangeListener(listener, getOldConfigFile());
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-groovy-grailsproject
private void updateListener(FileChangeListener listener, File oldDir, File newDir) {
if (oldDir == null || !oldDir.equals(newDir)) {
if (oldDir != null) {
FileUtil.removeFileChangeListener(listener, oldDir);
}
if (newDir != null) {
FileUtil.addFileChangeListener(listener, newDir);
}
}
}
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-java-project-ui
private synchronized void updateFileListeners(@NonNull final Collection<? extends File> newFiles) {
final Collection<File> toAdd = new HashSet<>(newFiles);
toAdd.removeAll(currentFiles);
final Collection<File> toRemove = new HashSet<>(currentFiles);
toRemove.removeAll(newFiles);
for (File f : toRemove) {
FileUtil.removeFileChangeListener(this, f);
}
for (File f : toAdd) {
FileUtil.addFileChangeListener(this, f);
}
currentFiles.addAll(toAdd);
currentFiles.removeAll(toRemove);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-ruby-rakeproject
public PP(String path, RakeProjectHelper helper) {
this.path = path;
this.helper = helper;
FileUtil.addFileChangeListener(this, new File(FileUtil.toFile(dir()), path.replace('/', File.separatorChar)));
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-clientproject
public ImpFilesNL(Project p) {
project = (ClientSideProject)p;
listener = new Listener();
Set<File> temp = new HashSet();
for (String name: ImportantFilesChildren.FILES.keySet()) {
File f = FileUtil.normalizeFile(new File(project.getProjectDirectory().getPath() + "/" + name));
if (temp.add(f)) {
FileUtil.addFileChangeListener(listener, f);
}
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-api-framework
final void refreshFrameworkCommands() {
List<FrameworkCommand> freshCommands = getFrameworkCommandsInternal();
File plugins = getPluginsDirectory();
if (plugins != null) {
// intentionally used isFile() because directory does not need to exist
assert !plugins.isFile() : "Plugins is expected to be a directory: " + plugins;
synchronized (this) {
if (pluginListener == null) {
pluginListener = new PluginListener();
FileUtil.addFileChangeListener(pluginListener, plugins);
}
}
}
synchronized (COMMANDS_CACHE) {
Map<String, List<FrameworkCommand>> moduleCommands = COMMANDS_CACHE.get(phpModule);
if (moduleCommands == null) {
moduleCommands = new HashMap<>();
}
moduleCommands.put(getFrameworkName(), freshCommands);
COMMANDS_CACHE.put(phpModule, moduleCommands);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-apisupport-project
DualLayers(FileSystem explicit) {
this.explicit = explicit;
NbModuleProvider nbmp = project.getLookup().lookup(NbModuleProvider.class);
File clazz = nbmp != null ? nbmp.getClassesDirectory() : null;
if (clazz != null) {
generated = new File(clazz, ManifestManager.GENERATED_LAYER_PATH);
FileUtil.addFileChangeListener(this, generated);
} else {
generated = null;
}
configure();
setPropagateMasks(true);
}
private void configure() {
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-maven-repository
@Override protected void addNotify() {
RepositoryPreferences.getInstance().addChangeListener(this);
FileUtil.addFileChangeListener(this, MavenCli.DEFAULT_USER_SETTINGS_FILE);
addChangeListener(this);
addNotifyCalled = true;
}
@Override protected void removeNotify() {
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-utils
@Override
protected boolean addFileChangeListenerImpl(FileChangeListener listener, FileSystem fileSystem, String path) {
for (CndFileSystemProvider provider : cache) {
if (provider.addFileChangeListenerImpl(listener, fileSystem, path)) {
return true;
}
}
if (CndFileUtils.isLocalFileSystem(fileSystem)) {
FileUtil.addFileChangeListener(listener, FileUtil.normalizeFile(new File(path)));
return true;
} else {
return false;
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-ruby-rakeproject
private RakeProjectHelper(FileObject dir, Document projectXml, ProjectState state, RakeBasedProjectType type) {
this.dir = dir;
assert dir != null && FileUtil.toFile(dir) != null;
this.state = state;
assert state != null;
this.type = type;
assert type != null;
this.projectXml = projectXml;
assert projectXml != null;
properties = new ProjectProperties(this);
fileListener = new FileListener();
FileUtil.addFileChangeListener(fileListener, resolveFile(PROJECT_XML_PATH));
FileUtil.addFileChangeListener(fileListener, resolveFile(PRIVATE_XML_PATH));
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-clientproject
public static BowerProblemProvider create(Project project) {
BowerProblemProvider problemProvider = new BowerProblemProvider(project);
problemProvider.addFileChangesListeners("bower.json", getBowerRcDir(project.getProjectDirectory()), ".bowerrc");
FileUtil.addFileChangeListener(problemProvider.bowerrcListener, new File(project.getProjectDirectory().getPath() + "/.bowerrc"));
return problemProvider;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-ejbjarproject
public void initialize() throws FileStateInvalidException {
EjbJarProject.this.evaluator().addPropertyChangeListener(this);
if (!isCopyOnSaveEnabled()) {
return;
}
metaBase = getEjbModule().getMetaInf();
metaBaseValue = evaluator().getProperty(EjbJarProjectProperties.META_INF);
if (resources != null) {
FileUtil.removeFileChangeListener(this, resources);
}
resources = getEjbModule().getResourceDirectory();
buildClasses = evaluator().getProperty(ProjectProperties.BUILD_CLASSES_DIR);
if (metaBase != null) {
metaBase.getFileSystem().addFileChangeListener(this);
}
if (resources != null) {
FileUtil.addFileChangeListener(this, resources);
}
LOGGER.log(Level.FINE, "Meta directory is {0}", metaBaseValue);
}
内容来源于网络,如有侵权,请联系作者删除!