From 661837fd4b7970e1c394c329a534773d1e7fd1cb Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Mon, 5 Aug 2024 14:32:53 -0500 Subject: [PATCH] Added a wiki button --- .../simcontrol/SimControlApplication.java | 23 ++++++++++++++++-- .../utils/SimControlActionController.java | 2 +- .../SimControlApplication.properties | 4 +++ .../simcontrol/resources/question_22x22.png | Bin 0 -> 378 bytes 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 trick_source/java/src/main/resources/trick/simcontrol/resources/question_22x22.png diff --git a/trick_source/java/src/main/java/trick/simcontrol/SimControlApplication.java b/trick_source/java/src/main/java/trick/simcontrol/SimControlApplication.java index ab4aeb05..1f25b8cc 100644 --- a/trick_source/java/src/main/java/trick/simcontrol/SimControlApplication.java +++ b/trick_source/java/src/main/java/trick/simcontrol/SimControlApplication.java @@ -17,6 +17,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; +import java.awt.Desktop; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.BufferedReader; @@ -30,6 +31,7 @@ import java.net.InetSocketAddress; import java.net.MulticastSocket; import java.net.UnknownHostException; import java.net.SocketTimeoutException; +import java.net.URI; import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.channels.NotYetConnectedException; @@ -240,6 +242,18 @@ public class SimControlApplication extends TrickApplication implements PropertyC launchTrickApplication("mtv", host + " " + port); } + @Action + public void openWiki() { + if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) { + try { + Desktop.getDesktop().browse(new URI("https://nasa.github.io/trick/index")); + } + catch(Exception e) { + System.out.println("Exception occurred while opening wiki: " + e.getMessage()); + } + } + } + @Action public void freezeAt() { actionController.handleFreezeAt(simState.getExecOutTime(), getMainFrame()); @@ -970,9 +984,14 @@ public class SimControlApplication extends TrickApplication implements PropertyC "---", "startMTV", "---", - "throttle" + "throttle", + "---", + "openWiki" }; - JToolBar toolBar = new JToolBar(); + JToolBar toolBar = new JToolBar(); + //JButton button = new JButton("openWiki"); + //button.setPreferredSize(new Dimension(22, 220)); // Set preferred size + //toolBar.add(button); for (String actionName : toolbarActionNames) { if (actionName.equals("---")) { toolBar.addSeparator(); diff --git a/trick_source/java/src/main/java/trick/simcontrol/utils/SimControlActionController.java b/trick_source/java/src/main/java/trick/simcontrol/utils/SimControlActionController.java index 0e2adc7c..dea9d703 100644 --- a/trick_source/java/src/main/java/trick/simcontrol/utils/SimControlActionController.java +++ b/trick_source/java/src/main/java/trick/simcontrol/utils/SimControlActionController.java @@ -237,7 +237,7 @@ public class SimControlActionController { } } } - + /** * Invoked when the users presses the Step button. * @param debug_flag single step the sim diff --git a/trick_source/java/src/main/resources/trick/simcontrol/resources/SimControlApplication.properties b/trick_source/java/src/main/resources/trick/simcontrol/resources/SimControlApplication.properties index 87c64763..a35b7cdf 100644 --- a/trick_source/java/src/main/resources/trick/simcontrol/resources/SimControlApplication.properties +++ b/trick_source/java/src/main/resources/trick/simcontrol/resources/SimControlApplication.properties @@ -24,6 +24,10 @@ startMTV.Action.text = Start &Event/Malfunction Trick View startMTV.Action.shortDescription = Start Event/Malfunction Trick View (MTV) startMTV.Action.icon = mtv_22x22.png +openWiki.Action.text = Open Trick Wiki +openWiki.Action.shortDescription = Open Trick Wiki in default browser +openWiki.Action.icon = question_22x22.png + freezeAt.Action.text = Freeze &At... freezeAt.Action.shortDescription = Freeze At diff --git a/trick_source/java/src/main/resources/trick/simcontrol/resources/question_22x22.png b/trick_source/java/src/main/resources/trick/simcontrol/resources/question_22x22.png new file mode 100644 index 0000000000000000000000000000000000000000..8b9d980d70245ca36f3f154aa67e4bd3e0880bba GIT binary patch literal 378 zcmeAS@N?(olHy`uVBq!ia0vp^Vj#@H3?x5i&EW)6u>n3IuI>dsKqieqj=|?+K%?bK zg8YIRj@jH17fxB=_o%Pv zY<_suy~@y^*3A1C<`(NMd}`5n_H2X}&y6+Ott+P7%986f%sqR+?VG#i%-7`%{1!zI pLyz>`33+%;xjK63mb&lZpQYuycy+%;{5A#!pQo#z%Q~loCIC-ldrJTS literal 0 HcmV?d00001