Skip to content

Commit

Permalink
use internal browser as fallback if system browser not available.
Browse files Browse the repository at this point in the history
release 5.6.3
  • Loading branch information
mfleisch committed Jun 14, 2023
1 parent 1e89923 commit ab1d648
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#here you can provide properties that may be needed during build- AND during runtime and should not be editable by the user at runtime
de.unijena.bioinf.siriusFrontend.version=5.7.3-SNAPSHOT
de.unijena.bioinf.siriusFrontend.version=5.7.3
de.unijena.bioinf.sirius.version=4.12.14
de.unijena.bioinf.fingerid.version=2.6.14
#
Expand Down Expand Up @@ -28,6 +28,7 @@ de.unijena.bioinf.utils.errorReport.softwareName=SIRIUS
de.unijena.bioinf.sirius.description=SIRIUS is a java-based software framework for discovering a landscape of de-novo identification of metabolites using single and tandem mass spectrometry. SIRIUS uses isotope pattern analysis for detecting the molecular formula and further analyses the fragmentation pattern of a compound using fragmentation trees. Fragmentation trees can be uploaded to CSI:FingerID via a web service, and results can be displayed in the SIRIUS graphical user interface.
de.unijena.bioinf.sirius.download=https://bio.informatik.uni-jena.de/software/sirius/
de.unijena.bioinf.sirius.ws.default.name=.sirius
de.unijena.bioinf.sirius.docu.url=https://boecker-lab.github.io/docs.sirius.github.io/
de.unijena.bioinf.fingerid.usedWorkers=FINGER_ID,CANOPUS,COVTREE
#### BEGIN Websevice Defaults - Might be changed for different hosting
## This is just for the connections check
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.net.URI;

import static de.unijena.bioinf.ms.gui.mainframe.MainFrame.MF;
Expand All @@ -50,8 +51,13 @@ public synchronized void actionPerformed(ActionEvent e) {
try {
GuiUtils.openURL(path(), "Open User Portal", true);
} catch (Exception ex2) {
LoggerFactory.getLogger(getClass()).error("Could not Open User Portal in System Browser", ex2);
new ExceptionDialog(MF, "Could not Open User Portal in System Browser: " + ex2.getMessage());
LoggerFactory.getLogger(getClass()).error("Could not Open 'User Portal' in system browser, Try internal browser as fallback.", ex2);
try {
GuiUtils.openURL(path(), "Open User Portal (internal)", false);
} catch (IOException ex) {
LoggerFactory.getLogger(getClass()).error("Could neither open 'User Portal' in system browser nor in internal Browser." + System.lineSeparator() + "Please copy the url to your browser: " + path(), ex2);
new ExceptionDialog(MF, "Could neither open 'User Portal' in system browser nor in internal Browser: " + ex2.getMessage() + System.lineSeparator() + "Please copy the url to your browser: " + path());
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
package de.unijena.bioinf.ms.gui.actions;

import de.unijena.bioinf.ms.gui.configs.Icons;
import de.unijena.bioinf.ms.gui.dialogs.ExceptionDialog;
import de.unijena.bioinf.ms.gui.utils.GuiUtils;
import de.unijena.bioinf.ms.properties.PropertyManager;
import org.slf4j.LoggerFactory;

import javax.swing.*;
Expand All @@ -29,8 +32,9 @@
import java.net.URI;
import java.net.URISyntaxException;

public class OpenOnlineDocumentationAction extends AbstractAction {
import static de.unijena.bioinf.ms.gui.mainframe.MainFrame.MF;

public class OpenOnlineDocumentationAction extends AbstractAction {
public OpenOnlineDocumentationAction() {
super("Help");
putValue(Action.LARGE_ICON_KEY, Icons.HELP_32);
Expand All @@ -39,10 +43,23 @@ public OpenOnlineDocumentationAction() {

@Override
public void actionPerformed(ActionEvent e) {
String url = PropertyManager.getProperty("de.unijena.bioinf.sirius.docu.url");
try {
Desktop.getDesktop().browse(new URI("https://boecker-lab.github.io/docs.sirius.github.io/"));
} catch (IOException | URISyntaxException er) {
LoggerFactory.getLogger(this.getClass()).error(er.getMessage(), er);
URI uri = new URI(url);
try {
GuiUtils.openURL(uri, "Open Online Documentation", true);
} catch (IOException er) {
LoggerFactory.getLogger(getClass()).error("Could not 'Online Documentation' in system browser, Try internal browser as fallback.", er);
try {
GuiUtils.openURL(uri, "Open Online Documentation (internal)", false);
} catch (IOException ex2) {
LoggerFactory.getLogger(getClass()).error("Could neither open 'Online Documentation' in system browser nor in internal Browser." + System.lineSeparator() + "Please copy the url to your browser: " + uri, ex2);
new ExceptionDialog(MF, "Could neither open 'Online Documentation' in system browser nor in SIRIUS' internal browser: " + ex2.getMessage() + System.lineSeparator() + "Please copy the url to your browser: " + uri);
}
LoggerFactory.getLogger(this.getClass()).error(er.getMessage(), er);
}
} catch (URISyntaxException ex) {
new ExceptionDialog(MF,"Malformed URL '" + url + "'. Cause: " + ex.getMessage());
}
}
}

0 comments on commit ab1d648

Please sign in to comment.