summaryrefslogtreecommitdiff
path: root/BKULocal/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'BKULocal/src/main/java')
-rw-r--r--BKULocal/src/main/java/at/gv/egiz/bku/local/conf/SpringConfigurator.java2
-rw-r--r--BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java16
-rw-r--r--BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSTALFactory.java6
3 files changed, 16 insertions, 8 deletions
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/conf/SpringConfigurator.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/conf/SpringConfigurator.java
index 09b0ebab..7b2641ff 100644
--- a/BKULocal/src/main/java/at/gv/egiz/bku/local/conf/SpringConfigurator.java
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/conf/SpringConfigurator.java
@@ -134,7 +134,7 @@ public class SpringConfigurator extends Configurator implements
try {
return r.getInputStream();
} catch (IOException e) {
- log.error("Cannot read manifest data:" + e);
+ log.error("Cannot read manifest data: " + e);
}
}
return null;
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java
index d551ae0d..c957e132 100644
--- a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java
@@ -17,6 +17,7 @@
package at.gv.egiz.bku.local.gui;
import at.gv.egiz.bku.gui.AbstractHelpListener;
+import at.gv.egiz.bku.gui.DefaultHelpListener;
import java.awt.Desktop;
import java.io.IOException;
import java.net.URISyntaxException;
@@ -24,30 +25,37 @@ import java.net.URL;
import java.util.Locale;
/**
- *
+ * Open help document in browser, fallback to default (swing dialog) if Java Desktop API not supported.
+ *
* @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
*/
public class LocalHelpListener extends AbstractHelpListener {
protected Desktop desktop;
+ protected DefaultHelpListener fallback;
public LocalHelpListener(URL baseURL, Locale locale) {
super(baseURL, locale);
if (Desktop.isDesktopSupported()) {
desktop = Desktop.getDesktop();
+ } else {
+ log.info("Java Desktop API not available on current platform (libgnome installed?), falling back to DefaultHelpListener");
+ fallback = new DefaultHelpListener(baseURL, locale);
}
}
@Override
public void showDocument(URL helpDocument, String helpTopic) throws IOException, URISyntaxException {
- if (desktop == null) {
- log.error("Failed to open default browser: Desktop API not available (libgnome installed?)");
- } else {
+ if (desktop != null) {
if (!desktop.isSupported(Desktop.Action.BROWSE)) {
log.error("Failed to open default browser: The system provides the Desktop API, but does not support the BROWSE action");
} else {
Desktop.getDesktop().browse(helpDocument.toURI());
}
+ } else if (fallback != null) {
+ fallback.showDocument(helpDocument, helpTopic);
+ } else {
+ log.error("failed to display help document");
}
}
}
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSTALFactory.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSTALFactory.java
index 2204b338..008e0581 100644
--- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSTALFactory.java
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSTALFactory.java
@@ -27,6 +27,7 @@ import javax.swing.WindowConstants;
import at.gv.egiz.bku.gui.BKUGUIFacade;
import at.gv.egiz.bku.gui.BKUGUIImpl;
import at.gv.egiz.bku.gui.DefaultHelpListener;
+import at.gv.egiz.bku.local.gui.LocalHelpListener;
import at.gv.egiz.stal.STAL;
import at.gv.egiz.stal.STALFactory;
import java.net.URL;
@@ -47,11 +48,10 @@ public class LocalSTALFactory implements STALFactory {
if (locale != null) {
dialog.setLocale(locale);
}
- DefaultHelpListener helpListener = null;
+ LocalHelpListener helpListener = null;
try {
if (helpURL != null) {
-// helpListener = new LocalHelpListener(new URL(helpURL), dialog.getLocale());
- helpListener = new DefaultHelpListener(new URL(helpURL), locale);
+ helpListener = new LocalHelpListener(new URL(helpURL), locale);
} else {
log.warn("no HELP URL configured, help system disabled");
}