Author: ruschein
Date: 2010-02-03 15:35:57 -0800 (Wed, 03 Feb 2010)
New Revision: 19170
Modified:
cytoscape/trunk/src/cytoscape/util/OpenBrowser.java
Log:
Refactored starting a browser on Linux.
Modified: cytoscape/trunk/src/cytoscape/util/OpenBrowser.java
===================================================================
--- cytoscape/trunk/src/cytoscape/util/OpenBrowser.java 2010-02-03 23:17:51 UTC
(rev 19169)
+++ cytoscape/trunk/src/cytoscape/util/OpenBrowser.java 2010-02-03 23:35:57 UTC
(rev 19170)
@@ -1,7 +1,7 @@
/*
File: OpenBrowser.java
- Copyright (c) 2006, The Cytoscape Consortium (www.cytoscape.org)
+ Copyright (c) 2006-2010, The Cytoscape Consortium (www.cytoscape.org)
The Cytoscape Consortium is:
- Institute for Systems Biology
@@ -49,14 +49,10 @@
import java.util.Properties;
-/**
- *
- */
public abstract class OpenBrowser {
+ static String[] LINUX_BROWSERS =
+ { "xdg-open", "htmlview", "firefox", "mozilla", "konqueror",
"chrome", "chromium" };
- static String LINUX_PATH1 = "xdg-open";
- static String LINUX_PATH2 = "htmlview";
-
static String MAC_PATH = "open";
private static final String WIN_PATH = "rundll32";
@@ -98,7 +94,8 @@
return tryExecute(cmd) == 0;
}
- private static boolean openURLOnLinux(final String url, final String
defBrowser) {
+ private static boolean openURLOnLinux(final String url, final String
defBrowser)
+ {
String cmd;
if (defBrowser != null) {
cmd = defBrowser + " " + url;
@@ -107,13 +104,14 @@
return true;
}
- cmd = LINUX_PATH1 + " " + url;
- CyLogger.getLogger().info("Opening URL by command \"" + cmd +
"\"");
- if (tryExecute(cmd) == 0)
+ for (final String browser : LINUX_BROWSERS) {
+ cmd = browser + " " + url;
+ CyLogger.getLogger().info("Opening URL by command \"" +
cmd + "\"");
+ if (tryExecute(cmd) == 0)
+ return true;
+ }
- cmd = LINUX_PATH2 + " " + url;
- CyLogger.getLogger().info("Opening URL by command \"" + cmd +
"\"");
- return tryExecute(cmd) == 0;
+ return false;
}
/**
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.