public void setLocation(Location location, Iterable<? extends Path> paths) { LocationContainer container = this.containers.get(location); if (container == null) { container = new LocationContainer(location); this.containers.put(location, container); } container.setPaths(paths); } public void setLocation(Location location, String moduleName, Iterable<? extends Path> paths) {
public void close() { Collection<LocationContainer> values = this.containers.values(); for (LocationContainer locationContainer : values) { locationContainer.clear(); } } }
@Override public Location getLocationForModule(Location location, JavaFileObject fo) { validateModuleLocation(location, ""); //$NON-NLS-1$ Path path = null; if (fo instanceof ArchiveFileObject) { path = ((ArchiveFileObject) fo).file.toPath(); return this.locationHandler.getLocation(location, path); } else if (fo instanceof EclipseFileObject) { path = ((EclipseFileObject) fo).f.toPath(); try { path = path.toRealPath(); } catch (IOException e) { e.printStackTrace(); } LocationContainer container = this.locationHandler.getLocation(location); while (path != null) { Location loc = container.get(path); if (loc != null) return loc; path = path.getParent(); } } return null; }
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) {
public Location getLocation(Location loc, Path path) { LocationContainer forwarder = this.containers.get(loc); if (forwarder != null) { return forwarder.get(path); } return null; } public LocationContainer getLocation(Location location) {
public LocationWrapper getLocation(Location loc, String moduleName) { if (loc instanceof LocationWrapper) { loc = ((LocationWrapper) loc).loc; } LocationContainer forwarder = this.containers.get(loc); if (forwarder != null) { return forwarder.get(moduleName); } return null; }
@Override void setPaths(Iterable<? extends Path> paths) { super.setPaths(paths); this.clear(); } @Override