Bug 561644: Link Handlers preference page blocks UI

Don't call lsregister for each registered scheme. Only call it once.

Change-Id: I0a29904ad39a7330e5b73c61b811709b3c689b9a
diff --git a/bundles/org.eclipse.urischeme/src/org/eclipse/urischeme/internal/registration/RegistrationMacOsX.java b/bundles/org.eclipse.urischeme/src/org/eclipse/urischeme/internal/registration/RegistrationMacOsX.java
index ca9d38b..6899c85 100644
--- a/bundles/org.eclipse.urischeme/src/org/eclipse/urischeme/internal/registration/RegistrationMacOsX.java
+++ b/bundles/org.eclipse.urischeme/src/org/eclipse/urischeme/internal/registration/RegistrationMacOsX.java
@@ -36,6 +36,8 @@
 	private IFileProvider fileProvider;
 	private IProcessExecutor processExecutor;
 
+	private String lsRegisterOutput = null;
+
 	public RegistrationMacOsX() {
 		this(new FileProvider(), new ProcessExecutor());
 	}
@@ -58,13 +60,11 @@
 	public List<ISchemeInformation> getSchemesInformation(Collection<IScheme> schemes) throws Exception {
 		List<ISchemeInformation> returnList = new ArrayList<>();
 
-		String lsRegisterOutput = processExecutor.execute(LSREGISTER, DUMP);
-
 		for (IScheme scheme : schemes) {
 
 			SchemeInformation schemeInfo = new SchemeInformation(scheme.getName(), scheme.getDescription());
 
-			String location = determineHandlerLocation(lsRegisterOutput, scheme.getName());
+			String location = determineHandlerLocation(getLsRegisterOutput(), scheme.getName());
 			if (location != "" && getEclipseLauncher().startsWith(location)) { //$NON-NLS-1$
 				schemeInfo.setHandled(true);
 			}
@@ -75,6 +75,14 @@
 		return returnList;
 	}
 
+	private String getLsRegisterOutput() throws Exception {
+		if (this.lsRegisterOutput != null) {
+			return this.lsRegisterOutput;
+		}
+		this.lsRegisterOutput = processExecutor.execute(LSREGISTER, DUMP);
+		return this.lsRegisterOutput;
+	}
+
 	private String determineHandlerLocation(String lsRegisterDump, String scheme) throws Exception {
 
 		String[] lsRegisterEntries = lsRegisterDump.split("-{80}\n"); //$NON-NLS-1$