diff --git a/src/java/org/xj3d/ui/awt/widgets/AWTConsoleWindow.java b/src/java/org/xj3d/ui/awt/widgets/AWTConsoleWindow.java index 5a7d1f41368c5ff8ec49b5ed946e2206fe993107..5126bb6d5d2e7b9066f1e3fb8e13bbb7c872b130 100644 --- a/src/java/org/xj3d/ui/awt/widgets/AWTConsoleWindow.java +++ b/src/java/org/xj3d/ui/awt/widgets/AWTConsoleWindow.java @@ -17,6 +17,9 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; // Local imports import org.web3d.util.Xj3dVersionInformation; @@ -33,15 +36,17 @@ import org.web3d.vrml.sav.DocumentLocator; * @author Justin Couch * @version $Revision: 1.1 $ */ -public class AWTConsoleWindow extends Frame - implements ActionListener, ErrorHandler { - +public class AWTConsoleWindow extends Frame implements ActionListener, ErrorHandler +{ /** The textfield to put the error information in */ private TextArea errorField; /** Clear button to remove stuff from window */ private Button clearButton; + /** Issues button to launch issues list */ + private Button issuesButton; + /** DocumentLocator used for printing out line/column information */ private DocumentLocator docLocator; @@ -63,9 +68,14 @@ public class AWTConsoleWindow extends Frame clearButton = new Button("Clear"); clearButton.addActionListener(AWTConsoleWindow.this); - p1.add(clearButton); + issuesButton = new Button("Issues list"); + issuesButton.addActionListener(AWTConsoleWindow.this); + if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) + p1.add(issuesButton); + else System.out.println("Unable to support issues button, this installation does not support Java Desktop"); + setSize(800, 600); // wide enough for typical paths setLocation(80, 80); @@ -249,7 +259,26 @@ public class AWTConsoleWindow extends Frame public void actionPerformed(ActionEvent evt) { Object src = evt.getSource(); - if(src == clearButton) + if (src == clearButton) + { errorField.setText(""); } + else if (src == issuesButton) + { + String issuesUrl = "https://gitlab.nps.edu/Savage/xj3d/issues"; + // https://stackoverflow.com/questions/5226212/how-to-open-url-in-default-webbrowser-using-java + if (Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) + { + try + { + URI issuesURI = new URI(issuesUrl); + Desktop.getDesktop().browse(issuesURI); + } + catch (IOException | URISyntaxException e) + { + System.err.println("Unable to connect to " + issuesUrl); + } + } + } + } }