Changeset 30372 in osm for applications/editors/josm


Ignore:
Timestamp:
2014-03-26T20:59:59+01:00 (11 years ago)
Author:
mkyral
Message:

PointInfo: Replace openWebPage function by josm.tools.OpenBrowser.

Location:
applications/editors/josm/plugins/pointInfo
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/pointInfo/README.md

    r30368 r30372  
    1414##Websites
    1515
    16  * OSM wiki - not availavle yet
     16 * OSM wiki - not available yet
    1717 * [JOSM svn](https://trac.openstreetmap.org/browser/subversion/applications/editors/josm/plugins/pointInfo)
    1818 * [Github](https://github.com/mkyral/josm-pointInfo)
  • applications/editors/josm/plugins/pointInfo/build.xml

    r30367 r30372  
    1515
    1616    <!-- enter the SVN commit message -->
    17     <property name="commit.message" value="PointInfo: Replace org.json with JOSM embedded (GPL-compliant) jsonp."/>
     17    <property name="commit.message" value="PointInfo: Replace openWebPage function by josm.tools.OpenBrowser."/>
    1818    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    1919    <property name="plugin.main.version" value="6238"/>
  • applications/editors/josm/plugins/pointInfo/src/org/openstreetmap/josm/plugins/pointinfo/PointInfoAction.java

    r30334 r30372  
    2222import java.awt.Cursor;
    2323import java.awt.Point;
    24 import java.awt.Desktop;
    2524import java.awt.event.ActionEvent;
    2625import java.awt.event.InputEvent;
     
    3938import javax.swing.event.HyperlinkEvent;
    4039import javax.swing.event.HyperlinkListener;
    41 import java.net.URI;
    42 import java.net.URISyntaxException;
    4340
    4441import org.openstreetmap.josm.Main;
     
    5552import org.openstreetmap.josm.tools.ImageProvider;
    5653import org.openstreetmap.josm.tools.Shortcut;
     54import org.openstreetmap.josm.tools.OpenBrowser;
    5755import org.xml.sax.SAXException;
    5856
     
    9189    private static Cursor getCursor() {
    9290        return ImageProvider.getCursor("crosshair", "info-sml");
    93     }
    94 
    95     private static void openWebpage(URI uri) {
    96         Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
    97         if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) {
    98             try {
    99                 desktop.browse(uri);
    100             } catch (Exception e) {
    101                 e.printStackTrace();
    102             }
    103         }
    10491    }
    10592
     
    137124                            mRuian.performAction(hle.getURL().toString());
    138125                          } else {
    139                             try {
    140                                 openWebpage(hle.getURL().toURI());
    141                             } catch (URISyntaxException e) {
    142                                 e.printStackTrace();
     126                            String ret = OpenBrowser.displayUrl(hle.getURL().toString());
     127                            if (ret != null) {
     128                              PointInfoUtils.showNotification(ret, "error");
    143129                            }
    144130                          }
Note: See TracChangeset for help on using the changeset viewer.