codeFiles += f
}
}
- codeFiles.sort().each{f ->
+ def jalviewJar = jar.archiveFileName.getOrNull()
+ // put jalview.jar first for CLASSPATH and .properties files reasons
+ codeFiles.sort{a, b -> ( a.getName() == jalviewJar ? -1 : ( b.getName() == jalviewJar ? 1 : a <=> b ) ) }.each{f ->
def name = f.getName()
def line = "code = ${getdownAppDistDir}/${name}\n"
getdownTextString += line
--- /dev/null
+# ************************************************
+# Copyright 2006,2007 Jeff Chapman
+#
+# This file is part of BrowserLauncher2.
+#
+# BrowserLauncher2 is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# BrowserLauncher2 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 Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with BrowserLauncher2; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# ************************************************
+# $Id: linuxUnixConfig.properties,v 1.3 2007/06/13 19:25:54 jchapman0 Exp $
+
+# delimiter for browser listing
+delimchar=;
+
+# list of browsers and arguments for using them
+# display name | executable name | start browser args | invoke already started browser | force new window
+browser.mozilla=Mozilla;mozilla;<browser> <url>;<browser> -remote openURL(<url>)
+browser.netscape=Netscape;netscape;<browser> <url>;<browser> -remote openURL(<url>)
+browser.firefox=Firefox;firefox;<browser> <url>;<browser> -new-tab <url>;<browser> -new-window <url>
+browser.mozilla-firefox=Firefox;mozilla-firefox;<browser> <url>;<browser> -remote openURL(<url>);<browser> -new-window <url>
+browser.konqueror=Konqueror;kfmclient;<browser> openURL <url>;<browser> newTab <url>;<browser> openURL <url>
+browser.opera=Opera;opera;<browser> <url>;<browser> -newpage <url>;<browser> -newwindow <url>
+browser.epiphany=Epiphany;epiphany;<browser> <url>;<browser> --new-tab <url>
+browser.chrome=Google Chrome;google-chrome;<browser> <url>;<browser> <url>;<browser> --new-window <url>
+browser.chrome-stable=Google Chrome;google-chrome-stable;<browser> <url>;<browser> <url>;<browser> --new-window <url>
--- /dev/null
+# ************************************************
+# Copyright 2006 Jeff Chapman
+#
+# This file is part of BrowserLauncher2.
+#
+# BrowserLauncher2 is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# BrowserLauncher2 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 Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with BrowserLauncher2; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# ************************************************
+# $Id: sunOSConfig.properties,v 1.2 2006/09/12 15:40:34 jchapman0 Exp $
+
+# delimiter for browser listing
+delimchar=;
+
+# list of browsers and arguments for using them
+# display name | executable name | start browser args | invoke already started browser
+browser.sdtwebclient=Default;sdtwebclient;<browser> <url>;<browser> -remote openURL(<url>)
+browser.mozilla=Mozilla;mozilla;<browser> <url>;<browser> -remote openURL(<url>)
+browser.netscape=Netscape;netscape;<browser> <url>;<browser> -remote openURL(<url>)
+browser.firefox=FireFox;firefox;<browser> <url>;<browser> -remote openURL(<url>);<browser> -new-window <url>
+browser.opera=Opera;opera;<browser> <url>;<browser> -newpage <url>;<browser> -newwindow <url>
+
--- /dev/null
+# ************************************************
+# Copyright 2006,2007 Jeff Chapman
+#
+# This file is part of BrowserLauncher2.
+#
+# BrowserLauncher2 is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# BrowserLauncher2 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 Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with BrowserLauncher2; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# ************************************************
+# $Id: windowsConfig.properties,v 1.6 2007/08/30 19:38:09 jchapman0 Exp $
+
+# delimiter for browser listing
+delimchar=;
+
+# windows versions and arguments for launching a browser
+# default (will be used for Win10 and Win11) is winNT
+# command for starting default browser | command for starting a specific browser | use registry
+windows.winVista=cmd.exe /c start "" "<url>";"<path><browser>.exe" <args> "<url>";true
+windows.win2000=cmd.exe /c start "" "<url>";"<path><browser>.exe" <args> "<url>";true
+windows.win9x=command.com /c start "<url>";"<path><browser>.exe" <args> "<url>";true
+windows.winNT=cmd.exe /c start "" "<url>";"<path><browser>.exe" <args> "<url>";true
+
+# properties used to find browsers in program files folder
+program.files.template={0}:\\Program Files
+# drive letters to try when looking for Program Files folder
+drive.letters=C;D;E
+
+#windows.win2000=cmd.exe /c start "" "<url>";cmd.exe /c start <browser> <args> "<url>"
+#windows.win9x=command.com /c start "<url>";command.com /c start <browser> <args> "<url>"
+#windows.winNT=cmd.exe /c start "" "<url>";cmd.exe /c start <browser> <args> "<url>"
+
+# list of browsers and arguments for using them and discovering them
+# browser display name | browser exe name | new window argument | directory containing exe
+browser.mozilla=Mozilla;mozilla;;mozilla.org
+browser.netscape=Netscape;netscape;;Netscape
+browser.mozilla-firefox=Mozilla Firefox;firefox;-new-window;Mozilla Firefox
+browser.firefox=Firefox;firefox;-new-window;Firefox
+browser.opera=Opera;opera;-newwindow;Opera
+browser.edge=Microsoft Edge;msedge;;Microsoft
+browser.kmeleon=K-Meleon;k-meleon;;K-Meleon
+browser.chrome=Google Chrome;chrome;;Google
label.address = Address
label.host = Host
label.port = Port
-label.default_browser_unix = Default Browser (Unix)
+label.default_browser_unix_windows = Default Browser (Unix, Windows)
label.send_usage_statistics = Send usage statistics
label.check_for_questionnaires = Check for questionnaires
label.check_for_latest_version = Check for latest version
label.address = Dirección
label.host = Host
label.port = Puerto
-label.default_browser_unix = Navegador por defecto (Unix)
+label.default_browser_unix_windows = Navegador por defecto (Unix, Windows)
label.send_usage_statistics = Enviar estadísticas de uso
label.check_for_questionnaires = Comprobar los cuestionarios
label.check_for_latest_version = Comprobar la última versión
*/
package jalview.gui;
-import jalview.util.BrowserLauncher;
-import jalview.util.Platform;
-
import java.awt.Point;
-import java.io.IOException;
import java.net.URL;
import javax.help.BadIDException;
import javax.help.HelpSet;
import javax.help.HelpSetException;
+import jalview.util.BrowserLauncher;
+import jalview.util.Platform;
+
/**
* Utility class to show the help documentation window
*
private static final String HELP_PAGE_ROOT = "http://www.jalview.org/help/";
/**
- * Defines selected help targets with links to inbuilt (Java) help page target,
- * and externally hosted help page. Will need to be maintained manually if help
- * pages are reorganised in future.
+ * Defines selected help targets with links to inbuilt (Java) help page
+ * target, and externally hosted help page. Will need to be maintained
+ * manually if help pages are reorganised in future.
*/
public enum HelpId
{
- Home("home", "help.html"), SequenceFeatureSettings("seqfeatures.settings", "html/features/featuresettings.html"),
- StructureViewer("viewingpdbs", "html/features/viewingpdbs.html"), PdbFts("pdbfts", "html/features/pdbsequencefetcher.html#pdbfts"),
- UniprotFts("uniprotfts", "html/features/uniprotsequencefetcher.html#uniprotfts");
+ Home("home", "help.html"),
+ SequenceFeatureSettings("seqfeatures.settings",
+ "html/features/featuresettings.html"),
+ StructureViewer("viewingpdbs", "html/features/viewingpdbs.html"),
+ PdbFts("pdbfts", "html/features/pdbsequencefetcher.html#pdbfts"),
+ UniprotFts("uniprotfts",
+ "html/features/uniprotsequencefetcher.html#uniprotfts");
private String id;
-
+
private String path;
private HelpId(String hepLoc, String htmlPath)
{
if (Platform.isJS())
{
+ /*
try
{
- BrowserLauncher.openURL(HELP_PAGE_ROOT + id.getPath());
+ */
+ BrowserLauncher.openURL(HELP_PAGE_ROOT + id.getPath());
+ /*
} catch (IOException e)
{
}
+ */
}
else
/**
setCustomProxyEnabled();
applyProxyButtonEnabled(false);
- defaultBrowser.setText(Cache.getDefault("DEFAULT_BROWSER", ""));
+ String browserPref = Cache.getDefault("DEFAULT_BROWSER", "");
+ if (browserPref != null)
+ {
+ defaultBrowser.getModel().setSelectedItem(browserPref);
+ }
usagestats.setSelected(Cache.getDefault("USAGESTATS", false));
// note antisense here: default is true
*/
// Proxy settings set first (to catch web services)
- Cache.setOrRemove("DEFAULT_BROWSER", defaultBrowser.getText());
+ Cache.setOrRemove("DEFAULT_BROWSER",
+ (String) defaultBrowser.getSelectedItem());
if (Cache.getProperty("DEFAULT_BROWSER") != null)
{
System.setProperty(IBrowserLaunching.BROWSER_SYSTEM_PROPERTY,
if (value == JFileChooser.APPROVE_OPTION)
{
- defaultBrowser.setText(chooser.getSelectedFile().getAbsolutePath());
+ defaultBrowser.getModel().setSelectedItem(
+ chooser.getSelectedFile().getAbsolutePath());
}
}
}
{
alignAddedStructures = alignAdded;
}
-
+
/**
- * called by the binding model to indicate when adding structures is happening or has been completed
+ * called by the binding model to indicate when adding structures is happening
+ * or has been completed
+ *
* @param addingStructures
*/
public synchronized void setAddingStructures(boolean addingStructures)
{
return;
}
- AlignmentPanel alignPanel = (AlignmentPanel) apanel; // Implementation error if this
- // cast fails
+ AlignmentPanel alignPanel = (AlignmentPanel) apanel; // Implementation error
+ // if this
+ // cast fails
useAlignmentPanelForSuperposition(alignPanel);
addStructure(pdbentry, seq, chains, alignPanel.alignFrame);
}
public void changeColour_actionPerformed(String colourSchemeName)
{
AlignmentI al = getAlignmentPanel().av.getAlignment();
- ColourSchemeI cs = ColourSchemes.getInstance()
- .getColourScheme(colourSchemeName, getAlignmentPanel().av, al,
- null);
+ ColourSchemeI cs = ColourSchemes.getInstance().getColourScheme(
+ colourSchemeName, getAlignmentPanel().av, al, null);
getBinding().colourByJalviewColourScheme(cs);
}
{
return false;
}
- int p=0;
- for (String pdbid:pdbids) {
+ int p = 0;
+ for (String pdbid : pdbids)
+ {
StructureMapping sm[] = getBinding().getSsm().getMapping(pdbid);
- if (sm!=null && sm.length>0 && sm[0]!=null) {
+ if (sm != null && sm.length > 0 && sm[0] != null)
+ {
p++;
}
}
- // only return true if there is a mapping for every structure file we have loaded
+ // only return true if there is a mapping for every structure file we have
+ // loaded
if (p == 0 || p != pdbids.length)
{
return false;
{
String filePath = null;
Pdb pdbclient = new Pdb();
- EBIAlfaFold afclient = new EBIAlfaFold();
+ EBIAlfaFold afclient = new EBIAlfaFold();
AlignmentI pdbseq = null;
String pdbid = processingEntry.getId();
long handle = System.currentTimeMillis()
+ Thread.currentThread().hashCode();
-
+
/*
* Write 'fetching PDB' progress on AlignFrame as we are not yet visible
*/
{
if (afclient.isValidReference(pdbid))
{
- pdbseq = afclient.getSequenceRecords(pdbid,processingEntry.getRetrievalUrl());
- } else {
- if (processingEntry.hasRetrievalUrl())
+ pdbseq = afclient.getSequenceRecords(pdbid,
+ processingEntry.getRetrievalUrl());
+ }
+ else
+ {
+ if (processingEntry.hasRetrievalUrl())
+ {
+ String safePDBId = java.net.URLEncoder.encode(pdbid, "UTF-8")
+ .replace("%", "__");
+
+ // retrieve from URL to new local tmpfile
+ File tmpFile = File.createTempFile(safePDBId,
+ "." + (PDBEntry.Type.MMCIF.toString().equals(
+ processingEntry.getType().toString()) ? "cif"
+ : "pdb"));
+ String fromUrl = processingEntry.getRetrievalUrl();
+ UrlDownloadClient.download(fromUrl, tmpFile);
+
+ // may not need this check ?
+ String file = tmpFile.getAbsolutePath();
+ if (file != null)
{
- String safePDBId = java.net.URLEncoder.encode(pdbid,"UTF-8").replace("%","__");
-
- // retrieve from URL to new local tmpfile
- File tmpFile = File.createTempFile(safePDBId,
- "." + (PDBEntry.Type.MMCIF.toString().equals(
- processingEntry.getType().toString()) ? "cif"
- : "pdb"));
- String fromUrl = processingEntry.getRetrievalUrl();
- UrlDownloadClient.download(fromUrl, tmpFile);
-
- // may not need this check ?
- String file = tmpFile.getAbsolutePath();
- if (file != null)
- {
- pdbseq = EBIAlfaFold.importDownloadedStructureFromUrl(fromUrl,tmpFile,pdbid,null,null,null);
- }
- } else {
- pdbseq = pdbclient.getSequenceRecords(pdbid);
+ pdbseq = EBIAlfaFold.importDownloadedStructureFromUrl(fromUrl,
+ tmpFile, pdbid, null, null, null);
}
+ }
+ else
+ {
+ pdbseq = pdbclient.getSequenceRecords(pdbid);
+ }
}
} catch (Exception e)
{
*/
public File saveSession()
{
- if (getBinding() == null) { return null;}
+ if (getBinding() == null)
+ {
+ return null;
+ }
File session = getBinding().saveSession();
long l = session.length();
- int wait=50;
- do {
- try {
+ int wait = 50;
+ do
+ {
+ try
+ {
Thread.sleep(5);
- } catch (InterruptedException e) {
- }
+ } catch (InterruptedException e)
+ {
+ }
long nextl = session.length();
- if (nextl!=l)
+ if (nextl != l)
{
wait = 50;
- l=nextl;
+ l = nextl;
}
- } while (--wait>0);
+ } while (--wait > 0);
return session;
}
@Override
public void showHelp_actionPerformed()
{
+ /*
try
{
- String url = getBinding().getHelpURL();
- if (url != null)
- {
- BrowserLauncher.openURL(url);
- }
- } catch (IOException ex)
+ */
+ String url = getBinding().getHelpURL();
+ if (url != null)
+ {
+ BrowserLauncher.openURL(url);
+ }
+ /*
+ }
+ catch (IOException ex)
{
System.err
.println("Show " + getViewerName() + " failed with: "
+ ex.getMessage());
}
+ */
}
+
@Override
public boolean hasViewerActionsMenu()
{
*/
package jalview.io;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.Objects;
+
import jalview.api.AlignExportSettingsI;
import jalview.bin.Cache;
import jalview.datamodel.AlignExportSettingsAdapter;
import jalview.gui.IProgressIndicator;
import jalview.util.MessageManager;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.Objects;
-
public abstract class HTMLOutput implements Runnable
{
protected AlignmentPanel ap;
* Constructor given an alignment panel (which should not be null)
*
* @param ap
- * @param desc
+ * @param desc
*/
public HTMLOutput(AlignmentPanel ap, String desc)
{
{
if (isLaunchInBrowserAfterExport() && !isHeadless())
{
+ /*
try
{
- jalview.util.BrowserLauncher
- .openURL("file:///" + getExportedFile());
+ */
+ jalview.util.BrowserLauncher.openURL("file:///" + getExportedFile());
+ /*
} catch (IOException e)
{
e.printStackTrace();
}
+ */
}
}
public void exportHTML(String outputFile)
{
setProgressMessage(MessageManager.formatMessage(
- "status.exporting_alignment_as_x_file", getDescription()));
+ "status.exporting_alignment_as_x_file", getDescription()));
try
{
if (outputFile == null)
return;
}
new Thread(this).start();
-
+
}
/**
*/
protected final String getDescription()
{
- return description;
+ return description;
}
}
\ No newline at end of file
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
+import javax.swing.ComboBoxModel;
+import javax.swing.DefaultComboBoxModel;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import jalview.io.BackupFiles;
import jalview.io.BackupFilesPresetEntry;
import jalview.io.IntKeyStringValueEntry;
+import jalview.util.BrowserLauncher;
import jalview.util.MessageManager;
import jalview.util.Platform;
import jalview.util.StringUtils;
protected JPasswordField proxyAuthPasswordPB = new JPasswordField();
- protected JTextField defaultBrowser = new JTextField();
+ protected JComboBox defaultBrowser = new JComboBox<String>();
protected ButtonGroup proxyType = new ButtonGroup();
browserLabel.setFont(LABEL_FONT);
browserLabel.setHorizontalAlignment(SwingConstants.TRAILING);
browserLabel.setText(
- MessageManager.getString("label.default_browser_unix"));
+ MessageManager.getString("label.default_browser_unix_windows"));
defaultBrowser.setFont(LABEL_FONT);
- defaultBrowser.setText("");
final String tooltip = JvSwingUtils.wrapTooltip(true,
MessageManager.getString("label.double_click_to_browse"));
defaultBrowser.setToolTipText(tooltip);
+ /*
defaultBrowser.addMouseListener(new MouseAdapter()
{
@Override
}
}
});
+ */
JPanel proxyPanel = initConnTabProxyPanel();
initConnTabCheckboxes();
GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(10, 0, 5, 5), 5, 1));
defaultBrowser.setFont(LABEL_FONT);
- defaultBrowser.setText("");
+
+ ComboBoxModel<String> cbModel = new DefaultComboBoxModel(
+ BrowserLauncher.getInstance().getBrowserList().toArray());
+ String browserPref = Cache.getProperty("DEFAULT_BROWSER");
+ if (browserPref != null)
+ {
+ cbModel.setSelectedItem(browserPref);
+ }
+ defaultBrowser.setModel(cbModel);
connectTab.add(defaultBrowser, new GridBagConstraints(1, 0, 1, 1, 1.0,
0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
}
/**
- * Show a dialog for the user to choose a file. Returns the chosen path, or null
- * on Cancel.
+ * Show a dialog for the user to choose a file. Returns the chosen path, or
+ * null on Cancel.
*
* @return
*/
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void ok_actionPerformed(ActionEvent e)
{
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void cancel_actionPerformed(ActionEvent e)
{
* DOCUMENT ME!
*
* @param e
- * DOCUMENT ME!
+ * DOCUMENT ME!
*/
public void annotations_actionPerformed(ActionEvent e)
{
package jalview.util;
-import java.io.IOException;
-
import edu.stanford.ejalbert.exception.BrowserLaunchingInitializingException;
import edu.stanford.ejalbert.exception.UnsupportedOperatingSystemException;
import jalview.bin.Cache;
import jalview.bin.Console;
-public class BrowserLauncher
+public class BrowserLauncher extends edu.stanford.ejalbert.BrowserLauncher
{
+ private static BrowserLauncher INSTANCE = null;
+
+ // get singleton BrowserLauncher instance
+ public static BrowserLauncher getInstance()
+ {
+ if (INSTANCE == null)
+ {
+ try
+ {
+ INSTANCE = new BrowserLauncher();
+ } catch (BrowserLaunchingInitializingException e)
+ {
+ Console.warn(MessageManager.formatMessage(
+ "exception.browser_unable_to_launch", e.getMessage()));
+ } catch (UnsupportedOperatingSystemException e)
+ {
+ Console.warn(MessageManager.formatMessage("exception."));
+ Console.debug(e.getMessage());
+ }
+ }
+ return INSTANCE;
+ }
+
+ public BrowserLauncher() throws BrowserLaunchingInitializingException,
+ UnsupportedOperatingSystemException
+ {
+ super();
+ }
+
private static String preferredBrowser = null;
- public static void openURL(String url) throws IOException
+ public static void openURL(String url)
{
if (Platform.isJS())
{
* @j2sIgnore
*/
{
- edu.stanford.ejalbert.BrowserLauncher bl = null;
- try
- {
- bl = new edu.stanford.ejalbert.BrowserLauncher();
- } catch (BrowserLaunchingInitializingException e)
- {
- Console.warn(MessageManager.formatMessage(
- "exception.browser_unable_to_launch", e.getMessage()));
- } catch (UnsupportedOperatingSystemException e)
- {
- Console.warn(MessageManager.formatMessage("exception."));
- Console.debug(e.getMessage());
- }
+ BrowserLauncher bl = getInstance();
if (bl != null)
{
if (Platform.isMac() || preferredBrowser == null)
}
else
{
- System.err.println(
- "**** OPENURL (" + preferredBrowser + ", " + url + ")");
bl.openURLinBrowser(preferredBrowser, url);
}
}
+ else
+ {
+ Console.warn("Could not open URL '" + url + "'");
+ }
}
}