站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 5.0.0

CollocationQueryImplementation (NetBeans General Queries API) - NetBeans API Javadoc 5.0.0

 

org.netbeans.spi.queries
Interface CollocationQueryImplementation


public interface CollocationQueryImplementation

A query which should typically be provided by a VCS to give information about whether some files can be considered part of one logical directory tree.

This should be treated as a heuristic, useful when deciding whether to use absolute or relative links between path locations.

The file names might refer to nonexistent files. A provider may or may not be able to say anything useful about them in this case.

File names passed to this query will already have been normalized according to the semantics of FileUtil.normalizeFile(java.io.File).

Threading note: implementors should avoid acquiring locks that might be held by other threads. Generally treat this interface similarly to SPIs in org.openide.filesystems with respect to threading semantics.

See Also:
CollocationQuery

Method Summary
 boolean areCollocated(File file1, File file2)
          Check whether two files are logically part of one directory tree.
 File findRoot(File file)
          Find a root of a logical tree containing this file, if any.
 

Method Detail

areCollocated

public boolean areCollocated(File file1,
                             File file2)
Check whether two files are logically part of one directory tree. For example, if both files are stored in CVS, with the same server (CVSROOT) they might be considered collocated. If they are to be collocated their absolute paths must share a prefix directory, i.e. they must be located in the same filesystem root. If nothing is known about them, return false.

Parameters:
file1 - one file
file2 - another file
Returns:
true if they are probably part of one logical tree

findRoot

public File findRoot(File file)
Find a root of a logical tree containing this file, if any. The path of the root (if there is one) must be a prefix of the path of the file.

Parameters:
file - a file on disk (must be an absolute URI)
Returns:
an ancestor directory which is the root of a logical tree, if any (else null) (must be an absolute URI)

 

Built on May 3 2007.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.