/** * Returns a handle to the singleton instance * * @return the singleton {@link UseScanManager} */ public synchronized static UseScanManager getInstance() { if (fUseScanProcessor == null) { fUseScanProcessor = new UseScanManager(); fApiComponentCache = new UseScanCache(DEFAULT_CACHE_SIZE); } return fUseScanProcessor; }
/** * Returns if the scan if a valid API use scan * * @param location * @return true if the scan is valid false otherwise */ public static boolean isValidScanLocation(String location) { if (location != null && location.length() > 0) { IPath path = new Path(location); File file = path.toFile(); return isValidDirectory(file) || isValidArchive(file); } return false; }
String[] locations; if (fLocations == null) { locations = getReportLocations(); } else { locations = fLocations; locations[i] = getExactScanLocation(locations[i]); if (locations[i] == null) { String message;
public void widgetSelected(SelectionEvent e) { String loc = getDirectory(null); if(loc != null) { String exactLocation = UseScanManager.getExactScanLocation(loc); if (exactLocation == null) addLocation(loc); else addLocation(exactLocation); } } });
/** * Validates that the scan are all still valid */ private void validateScans() { if (fLocationList.size() > 0) { String loc = null; for (Iterator<String> iterator = fLocationList.iterator(); iterator.hasNext();) { loc = iterator.next(); if (!UseScanManager.isValidScanLocation(loc)) { setErrorMessage(NLS.bind(PreferenceMessages.ApiUseScanPreferencePage_8, loc)); setValid(false); return; } } } setValid(true); setErrorMessage(null); }
IReferenceDescriptor[] externalDependencies = UseScanManager.getInstance().getExternalDependenciesFor(apiComponent, apiUseTypes, localmonitor.split(10)); try { if (externalDependencies != null) {
/** * Returns the scan * * @param location * @return */ public static String getExactScanLocation(String location) { File file = new File(location); if (isValidDirectory(file)) { return location; } file = new File(location, IApiCoreConstants.XML); if (isValidDirectory(file)) { return file.getAbsolutePath(); } return null; }
String loc = getDirectory(null); if (loc != null) { String exactLocation = UseScanManager.getExactScanLocation(loc); if (exactLocation == null) { addLocation(loc);
/** * Validates that the scan are all still valid */ private void validateScans() { if (fLocationList.size() > 0) { String loc = null; for (Iterator iterator = fLocationList.iterator(); iterator.hasNext();) { loc = (String) iterator.next(); if (!UseScanManager.isValidScanLocation(loc)) { setErrorMessage(NLS.bind(PreferenceMessages.ApiUseScanPreferencePage_8, loc)); setValid(false); return; } } } setValid(true); setErrorMessage(null); }