1 19 20 package org.netbeans.modules.queries; 21 22 import java.io.File ; 23 import org.netbeans.spi.queries.CollocationQueryImplementation; 24 25 31 public class ParentChildCollocationQuery implements CollocationQueryImplementation { 32 33 34 public ParentChildCollocationQuery() {} 35 36 public boolean areCollocated(File file1, File file2) { 37 if (file1.equals(file2)) { 38 return true; 39 } 40 String f1 = file1.getAbsolutePath(); 41 if ((file1.isDirectory() || !file1.exists()) && !f1.endsWith(File.separator)) { 42 f1 += File.separatorChar; 43 } 44 String f2 = file2.getAbsolutePath(); 45 if ((file2.isDirectory() || !file2.exists()) && !f2.endsWith(File.separator)) { 46 f2 += File.separatorChar; 47 } 48 return f1.startsWith(f2) || f2.startsWith(f1); 49 } 50 51 public File findRoot(File file) { 52 return null; 53 } 54 55 } 56 | Popular Tags |