X-Git-Url: https://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2Ffunction%2Fbrowser%2FBrowserLauncher.java;fp=tim%2Fprune%2Fbrowser%2FBrowserLauncher.java;h=1decbc3f586de321d7208dad537804af297d4da6;hp=fe4c79a3586a42560f7fca072fadfb509ed1f40f;hb=54b9d8bc8f0025ccf97a67d9dd217ef1f9cf082f;hpb=52bf9e8686c916be37a26a0b75340393d4478b05 diff --git a/tim/prune/browser/BrowserLauncher.java b/tim/prune/function/browser/BrowserLauncher.java similarity index 85% rename from tim/prune/browser/BrowserLauncher.java rename to tim/prune/function/browser/BrowserLauncher.java index fe4c79a..1decbc3 100644 --- a/tim/prune/browser/BrowserLauncher.java +++ b/tim/prune/function/browser/BrowserLauncher.java @@ -1,4 +1,4 @@ -package tim.prune.browser; +package tim.prune.function.browser; import javax.swing.JOptionPane; @@ -6,15 +6,17 @@ import javax.swing.JOptionPane; /** * Class to launch a browser window to show an external map */ -public class BrowserLauncher +public abstract class BrowserLauncher { - private String[] _browserCommand = null; - private boolean _urlNeedsQuotes = false; + private static boolean _initialised = false; + private static String[] _browserCommand = null; + private static boolean _urlNeedsQuotes = false; + /** - * Constructor to set up browser + * Init method to set up browser */ - public BrowserLauncher() + private static void init() { // First check if "which" command is available if (commandExists("which")) @@ -45,8 +47,10 @@ public class BrowserLauncher _urlNeedsQuotes = true; } } + _initialised = true; } + /** * Check if the specified command exists on the system * @param inCommand command to check @@ -66,12 +70,14 @@ public class BrowserLauncher return false; } + /** * Launch a browser window to show the given url * @param inUrl url to show */ - public void launchBrowser(String inUrl) + public static void launchBrowser(String inUrl) { + if (!_initialised) {init();} if (_browserCommand == null) { JOptionPane.showMessageDialog(null, "Cannot show url: " + inUrl); }