192 lines
7.4 KiB
Diff
192 lines
7.4 KiB
Diff
From 8139e1fa34bc8ee41021453235cb29e8013eefa4 Mon Sep 17 00:00:00 2001
|
|
From: Andras Fuchs <andras.fuchs@gmail.com>
|
|
Date: Thu, 25 Nov 2021 23:43:22 +0100
|
|
Subject: [PATCH] Remove the javax.help dependency
|
|
|
|
---
|
|
.../mihosoft/freerouting/gui/BoardFrame.java | 16 ++-
|
|
.../freerouting/gui/BoardMenuBar.java | 12 +-
|
|
.../freerouting/gui/BoardMenuHelp.java | 116 ------------------
|
|
3 files changed, 9 insertions(+), 135 deletions(-)
|
|
delete mode 100644 src/main/java/eu/mihosoft/freerouting/gui/BoardMenuHelp.java
|
|
|
|
diff --git a/src/main/java/eu/mihosoft/freerouting/gui/BoardFrame.java b/src/main/java/eu/mihosoft/freerouting/gui/BoardFrame.java
|
|
index d728053..dbe25c5 100644
|
|
--- a/src/main/java/eu/mihosoft/freerouting/gui/BoardFrame.java
|
|
+++ b/src/main/java/eu/mihosoft/freerouting/gui/BoardFrame.java
|
|
@@ -387,12 +387,12 @@ public void set_context_sensitive_help(java.awt.Component p_component, String p_
|
|
curr_component = p_component;
|
|
}
|
|
String help_id = "html_files." + p_help_id;
|
|
- javax.help.CSH.setHelpIDString(curr_component, help_id);
|
|
- if (help_broker==null) {
|
|
- FRLogger.warn("help_broker is null");
|
|
- return;
|
|
- }
|
|
- help_broker.enableHelpKey(curr_component, help_id, help_set);
|
|
+// javax.help.CSH.setHelpIDString(curr_component, help_id);
|
|
+// if (help_broker==null) {
|
|
+// FRLogger.warn("help_broker is null");
|
|
+// return;
|
|
+// }
|
|
+// help_broker.enableHelpKey(curr_component, help_id, help_set);
|
|
}
|
|
}
|
|
|
|
@@ -699,9 +699,7 @@ public void repaint_all()
|
|
final boolean is_web_start;
|
|
|
|
private final boolean help_system_used;
|
|
- static javax.help.HelpSet help_set = null;
|
|
- static javax.help.HelpBroker help_broker = null;
|
|
-
|
|
+
|
|
private final boolean confirm_cancel;
|
|
|
|
private final java.util.ResourceBundle resources;
|
|
diff --git a/src/main/java/eu/mihosoft/freerouting/gui/BoardMenuBar.java b/src/main/java/eu/mihosoft/freerouting/gui/BoardMenuBar.java
|
|
index db9dd06..272dfb6 100644
|
|
--- a/src/main/java/eu/mihosoft/freerouting/gui/BoardMenuBar.java
|
|
+++ b/src/main/java/eu/mihosoft/freerouting/gui/BoardMenuBar.java
|
|
@@ -48,16 +48,8 @@ static BoardMenuBar get_instance(BoardFrame p_board_frame,
|
|
menubar.add(info_menu);
|
|
javax.swing.JMenu other_menu = BoardMenuOther.get_instance(p_board_frame);
|
|
menubar.add(other_menu);
|
|
- if (p_help_system_used)
|
|
- {
|
|
- javax.swing.JMenu help_menu = new BoardMenuHelp(p_board_frame);
|
|
- menubar.add(help_menu);
|
|
- }
|
|
- else
|
|
- {
|
|
- javax.swing.JMenu help_menu = new BoardMenuHelpReduced(p_board_frame);
|
|
- menubar.add(help_menu);
|
|
- }
|
|
+ javax.swing.JMenu help_menu = new BoardMenuHelpReduced(p_board_frame);
|
|
+ menubar.add(help_menu);
|
|
return menubar;
|
|
}
|
|
|
|
diff --git a/src/main/java/eu/mihosoft/freerouting/gui/BoardMenuHelp.java b/src/main/java/eu/mihosoft/freerouting/gui/BoardMenuHelp.java
|
|
deleted file mode 100644
|
|
index 85d89a7..0000000
|
|
--- a/src/main/java/eu/mihosoft/freerouting/gui/BoardMenuHelp.java
|
|
+++ /dev/null
|
|
@@ -1,116 +0,0 @@
|
|
-/*
|
|
- * Copyright (C) 2014 Alfons Wirtz
|
|
- * website www.freerouting.net
|
|
- *
|
|
- * Copyright (C) 2017 Michael Hoffer <info@michaelhoffer.de>
|
|
- * Website www.freerouting.mihosoft.eu
|
|
-*
|
|
- * This program is free software: you can redistribute it and/or modify
|
|
- * it under the terms of the GNU General Public License as published by
|
|
- * the Free Software Foundation, either version 3 of the License, or
|
|
- * (at your option) any later version.
|
|
- *
|
|
- * This program is distributed in the hope that it will be useful,
|
|
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
- * GNU General Public License at <http://www.gnu.org/licenses/>
|
|
- * for more details.
|
|
- *
|
|
- * BoardMenuHelp.java
|
|
- *
|
|
- * Created on 19. Oktober 2005, 08:15
|
|
- *
|
|
- */
|
|
-
|
|
-package eu.mihosoft.freerouting.gui;
|
|
-
|
|
-import eu.mihosoft.freerouting.logger.FRLogger;
|
|
-
|
|
-import javax.help.CSH;
|
|
-import javax.help.HelpSet;
|
|
-import javax.help.HelpSetException;
|
|
-import java.net.URL;
|
|
-
|
|
-/**
|
|
- *
|
|
- * @author Alfons Wirtz
|
|
- */
|
|
-public class BoardMenuHelp extends BoardMenuHelpReduced
|
|
-{
|
|
- /**
|
|
- * Creates a new instance of BoardMenuHelp
|
|
- * Separated from BoardMenuHelpReduced to avoid ClassNotFound exception when the library
|
|
- * jh.jar is not found, which is only used in this extended class.
|
|
- */
|
|
- public BoardMenuHelp(BoardFrame p_board_frame)
|
|
- {
|
|
- super(p_board_frame);
|
|
- this.initialize_help(p_board_frame.get_locale());
|
|
- javax.swing.JMenuItem direct_help_window = new javax.swing.JMenuItem();
|
|
- direct_help_window.setText(this.resources.getString("direct_help"));
|
|
- if (direct_help != null)
|
|
- {
|
|
- direct_help_window.addActionListener(direct_help);
|
|
- }
|
|
- this.add(direct_help_window, 0);
|
|
- javax.swing.JMenuItem contents_window = new javax.swing.JMenuItem();
|
|
- contents_window.setText(this.resources.getString("contents"));
|
|
- if (contents_help != null)
|
|
- {
|
|
- contents_window.addActionListener(contents_help);
|
|
- }
|
|
- this.add(contents_window, 0);
|
|
- }
|
|
-
|
|
- private void initialize_help(java.util.Locale p_locale)
|
|
- {
|
|
- // try to find the helpset and create a HelpBroker object
|
|
- if (BoardFrame.help_broker == null)
|
|
- {
|
|
- String language = p_locale.getLanguage();
|
|
- String helpset_name;
|
|
- if (language.equalsIgnoreCase("de"))
|
|
- {
|
|
- helpset_name = "/eu/mihosoft/freerouting/helpset/de/Help.hs";
|
|
- }
|
|
- else
|
|
- {
|
|
- helpset_name = "/eu/mihosoft/freerouting/helpset/en/Help.hs";
|
|
- }
|
|
- try
|
|
- {
|
|
- // original author tries to get language specific url
|
|
- // via HelpSet utility methods which does not work that well
|
|
- // and doesn't really make sense if the language is specified
|
|
- // manually
|
|
- // TODO find out why previous approach does not work reliably
|
|
- URL hsURL = getClass().getResource(helpset_name);
|
|
- if (hsURL == null)
|
|
- {
|
|
- FRLogger.warn("HelpSet " + helpset_name + " not found.");
|
|
- }
|
|
- else
|
|
- {
|
|
- BoardFrame.help_set = new HelpSet(null, hsURL);
|
|
- }
|
|
- }
|
|
- catch (HelpSetException ee)
|
|
- {
|
|
- FRLogger.error("HelpSet " + helpset_name + " could not be opened.", ee);
|
|
- }
|
|
- if (BoardFrame.help_set != null)
|
|
- {
|
|
- BoardFrame.help_broker = BoardFrame.help_set.createHelpBroker();
|
|
- }
|
|
- if (BoardFrame.help_broker != null)
|
|
- {
|
|
- // CSH.DisplayHelpFromSource is a convenience class to display the helpset
|
|
- contents_help = new CSH.DisplayHelpFromSource(BoardFrame.help_broker);
|
|
- direct_help = new CSH.DisplayHelpAfterTracking(BoardFrame.help_broker);
|
|
- }
|
|
- }
|
|
- }
|
|
-
|
|
- private static CSH.DisplayHelpFromSource contents_help = null;
|
|
- private static CSH.DisplayHelpAfterTracking direct_help = null;
|
|
-}
|