1 19 20 package org.netbeans.api.queries; 21 22 import java.io.File ; 23 import org.netbeans.spi.queries.SharabilityQueryImplementation; 24 import org.openide.filesystems.FileUtil; 25 import org.openide.util.Lookup; 26 27 29 41 public final class SharabilityQuery { 42 43 private static final Lookup.Result<SharabilityQueryImplementation> implementations = 44 Lookup.getDefault().lookupResult(SharabilityQueryImplementation.class); 45 46 51 public static final int UNKNOWN = 0; 52 53 59 public static final int SHARABLE = 1; 60 61 67 public static final int NOT_SHARABLE = 2; 68 69 75 public static final int MIXED = 3; 76 77 private SharabilityQuery() {} 78 79 84 public static int getSharability(File file) { 85 if (file == null) throw new IllegalArgumentException (); 86 File normFile = FileUtil.normalizeFile(file); 87 for (SharabilityQueryImplementation sqi : implementations.allInstances()) { 88 int x = sqi.getSharability(normFile); 89 if (x != UNKNOWN) { 90 return x; 91 } 92 } 93 return UNKNOWN; 94 } 95 96 } 97 | Popular Tags |