--- a/versioning/apichanges.xml +++ a/versioning/apichanges.xml @@ -108,6 +108,21 @@ + refreshRecursively() method added to VCSInterceptor + + + + + + VCSInterceptor.refreshRecursively allows a version control system to get better control on behavior of recursive listener. + With this method a versioning system can disable recursive listening on specific folders (e.g. versioning system metadata) and on the other hand + learn about and handle external changes inside the folder in its own way. + + + + + + Added getVisibilityQueryImplementation() method to VersioningSystem --- a/versioning/nbproject/project.properties +++ a/versioning/nbproject/project.properties @@ -41,7 +41,7 @@ javac.source=1.6 javadoc.name=Versioning -spec.version.base=1.16.0 +spec.version.base=1.17.0 is.autoload=true javadoc.arch=${basedir}/arch.xml --- a/versioning/src/org/netbeans/modules/versioning/FilesystemInterceptor.java +++ a/versioning/src/org/netbeans/modules/versioning/FilesystemInterceptor.java @@ -142,6 +142,12 @@ getInterceptor(FileUtil.toFile(fo), fo.isFolder(), "beforeChange").beforeChange(); // NOI18N } + @Override + public long refreshRecursively(File dir, long lastTimeStamp, List children) { + DelegatingInterceptor interceptor = getRefreshInterceptor(dir); + return interceptor.refreshRecursively(dir, lastTimeStamp, children); + } + private boolean needsLH(String... methodNames) { for (String methodName : methodNames) { if(master.needsLocalHistory(methodName)) { @@ -316,6 +322,13 @@ return new DelegatingInterceptor(vsInterceptor, localHistoryInterceptor, from, to, false); } + private DelegatingInterceptor getRefreshInterceptor (File dir) { + if (dir == null) return nullDelegatingInterceptor; + VersioningSystem vs = master.getOwner(dir); + VCSInterceptor vcsInterceptor = vs != null ? vs.getVCSInterceptor() : nullVCSInterceptor; + return new DelegatingInterceptor(vcsInterceptor, nullVCSInterceptor, dir, null, true); + } + private final DelegatingInterceptor nullDelegatingInterceptor = new DelegatingInterceptor() { public boolean beforeDelete() { return false; } public void doDelete() throws IOException { } @@ -501,9 +514,10 @@ return false; } } -// VCSInterceptor getInterceptor() { -// return interceptor; -// } + + public long refreshRecursively (File dir, long lastTimeStamp, List children) { + return interceptor.refreshRecursively(dir, lastTimeStamp, children); + } } private class FileEx { --- a/versioning/src/org/netbeans/modules/versioning/spi/VCSInterceptor.java +++ a/versioning/src/org/netbeans/modules/versioning/spi/VCSInterceptor.java @@ -42,6 +42,7 @@ import java.io.File; import java.io.IOException; +import java.util.List; /** * Versioning systems that need to intercept or listen to file system operations implement this class. @@ -226,4 +227,22 @@ */ public void beforeEdit(File file) { } + + /** Allows versioning system to exclude some children from recursive + * listening check. Also notifies the versioning whenever a refresh + * is required and allows the versioning to provide special timestamp + * for a directory. + * + * @param dir the directory to check timestamp for + * @param lastTimeStamp the previously known timestamp or -1 + * @param children add children that shall be integrated into this array + * @return the timestamp that shall represent this directory, it will + * be compared with timestamps of all children and the newest + * one will be kept and next time passed as lastTimeStamp. Return + * 0 if the directory does not have any special timestamp + * @since 1.17 + */ + public long refreshRecursively(File dir, long lastTimeStamp, List children) { + return -1; + } }