public void setLocation(Location location, String moduleName, Iterable<? extends Path> paths) { LocationWrapper wrapper = null; LocationContainer container = this.containers.get(location); if (container != null) { wrapper = container.get(moduleName); } else { container = new LocationContainer(location); this.containers.put(location, container); } if (wrapper == null) { // module name can't be null // TODO: Check unnamed modules can have their own module specific path - probably not if (moduleName.equals("")) { //$NON-NLS-1$ wrapper = new LocationWrapper(location, location.isOutputLocation(), paths); } else { wrapper = new ModuleLocationWrapper(location, moduleName, location.isOutputLocation(), paths); for (Path path : paths) { container.put(path, wrapper); } } } else { wrapper.setPaths(paths); } container.put(moduleName, wrapper); } public Iterable<Set<Location>> listLocationsForModules(Location location) {
@Override public Iterable<? extends Path> getLocationAsPaths(Location location) { if (location instanceof LocationWrapper) { return ((LocationWrapper) location).paths; } LocationWrapper loc = this.locationHandler.getLocation(location); if (loc == null) { return null; } return loc.getPaths(); }
@Override public Iterable<? extends File> getLocation(Location location) { if (location instanceof LocationWrapper) { return getFiles(((LocationWrapper) location).paths); } LocationWrapper loc = this.locationHandler.getLocation(location, ""); //$NON-NLS-1$ if (loc == null) { return null; } return getFiles(loc.getPaths()); }
public LocationWrapper(Location loc, boolean output, Iterable<? extends Path> paths) { this.loc = loc; this.output = output; setPaths(paths); }
@Override void setPaths(Iterable<? extends Path> paths) { super.setPaths(paths); this.clear(); } @Override