1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
package tim.prune.function.browser;
import tim.prune.App;
import tim.prune.GenericFunction;
import tim.prune.data.DataPoint;
import tim.prune.data.GeocacheCode;
/**
* Function to open a geocache page for the current point
*/
public class OpenCachePageFunction extends GenericFunction
{
/**
* Constructor
* @param inApp app object
*/
public OpenCachePageFunction(App inApp) {
super(inApp);
}
@Override
public String getNameKey() {
return "function.opengeocachepage";
}
/**
* Do the function call
*/
@Override
public void begin()
{
DataPoint currentPoint = _app.getTrackInfo().getCurrentPoint();
if (currentPoint == null) {
return;
}
String url = GeocacheCode.getUrl(currentPoint.getWaypointName());
if (url != null) {
BrowserLauncher.launchBrowser(url);
}
}
}
|