### Eclipse Workspace Patch 1.0 #P JMapViewer Index: src/org/openstreetmap/gui/jmapviewer/AttributionSupport.java =================================================================== --- src/org/openstreetmap/gui/jmapviewer/AttributionSupport.java (revision 36495) +++ src/org/openstreetmap/gui/jmapviewer/AttributionSupport.java (working copy) @@ -131,36 +131,32 @@ } public boolean handleAttribution(Point p, boolean click) { - if (source == null || !source.requiresAttribution()) + if (source == null || !source.requiresAttribution()) { return false; - - if (attrTextBounds != null && attrTextBounds.contains(p)) { - String attributionURL = source.getAttributionLinkURL(); - if (attributionURL != null) { - if (click) { - FeatureAdapter.openLink(attributionURL); - } - return true; + } + + if (getUrlAtPoint(p) != null) { + if (click) { + FeatureAdapter.openLink(getUrlAtPoint(p)); } - } else if (attrImageBounds != null && attrImageBounds.contains(p)) { - String attributionImageURL = source.getAttributionImageURL(); - if (attributionImageURL != null) { - if (click) { - FeatureAdapter.openLink(source.getAttributionImageURL()); - } - return true; - } - } else if (attrToUBounds != null && attrToUBounds.contains(p)) { - String termsOfUseURL = source.getTermsOfUseURL(); - if (termsOfUseURL != null) { - if (click) { - FeatureAdapter.openLink(termsOfUseURL); - } - return true; - } + return true; } + return false; } + + private String getUrlAtPoint(Point p) { + if (attrTextBounds != null && attrTextBounds.contains(p)) { + return source.getAttributionLinkURL(); + } + if (attrImageBounds != null && attrImageBounds.contains(p)) { + return source.getAttributionImageURL(); + } + if (attrToUBounds != null && attrToUBounds.contains(p)) { + return source.getTermsOfUseURL(); + } + return null; + } }