1 19 20 package org.netbeans.modules.ant.freeform; 21 22 import java.io.File ; 23 import org.netbeans.api.queries.SharabilityQuery; 24 import org.netbeans.spi.project.support.ant.AntProjectHelper; 25 import org.netbeans.spi.queries.SharabilityQueryImplementation; 26 27 31 public class FreeformSharabilityQuery implements SharabilityQueryImplementation { 32 33 private String nbproject; 34 private String nbprojectPrivate; 35 36 37 public FreeformSharabilityQuery(AntProjectHelper helper) { 38 nbproject = helper.resolveFile("nbproject").getAbsolutePath(); 39 nbprojectPrivate = helper.resolveFile("nbproject/private").getAbsolutePath(); 40 } 41 42 public int getSharability(File file) { 43 String absolutePath = file.getAbsolutePath(); 44 45 if (absolutePath.equals(nbproject)) { 46 return SharabilityQuery.MIXED; 47 } 48 49 if (absolutePath.startsWith(nbproject)) { 50 return absolutePath.startsWith(nbprojectPrivate) ? SharabilityQuery.NOT_SHARABLE : SharabilityQuery.SHARABLE; 51 } 52 53 return SharabilityQuery.UNKNOWN; 54 } 55 56 } 57 | Popular Tags |