From 51a02acc93ad80f349a60e226fffce1cd982d9fa Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 13 Aug 2009 09:27:34 +0000 Subject: [#427] No help in BKULocal git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@426 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/local/conf/SpringConfigurator.java | 2 +- .../java/at/gv/egiz/bku/local/gui/LocalHelpListener.java | 16 ++++++++++++---- .../java/at/gv/egiz/bku/local/stal/LocalSTALFactory.java | 6 +++--- 3 files changed, 16 insertions(+), 8 deletions(-) (limited to 'BKULocal/src/main/java/at/gv') 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 */ 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"); } -- cgit v1.2.3