Author: paperwing
Date: 2012-07-11 09:27:34 -0700 (Wed, 11 Jul 2012)
New Revision: 29829
Modified:
core3/impl/trunk/swing-util-impl/src/main/java/org/cytoscape/util/swing/internal/OpenBrowserImpl.java
Log:
fixes #1176 openURL() now shows dialog with copyable link if failed to open
system browser
Modified:
core3/impl/trunk/swing-util-impl/src/main/java/org/cytoscape/util/swing/internal/OpenBrowserImpl.java
===================================================================
---
core3/impl/trunk/swing-util-impl/src/main/java/org/cytoscape/util/swing/internal/OpenBrowserImpl.java
2012-07-11 15:20:18 UTC (rev 29828)
+++
core3/impl/trunk/swing-util-impl/src/main/java/org/cytoscape/util/swing/internal/OpenBrowserImpl.java
2012-07-11 16:27:34 UTC (rev 29829)
@@ -47,6 +47,8 @@
import java.net.URI;
import java.net.URISyntaxException;
+import javax.swing.JOptionPane;
+
import org.cytoscape.util.swing.OpenBrowser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -63,16 +65,20 @@
@Override
public boolean openURL(final String url) {
final Desktop desktop = Desktop.getDesktop();
+
try {
URI uri = new URI(url);
desktop.browse(uri);
+ throw new IOException("test");
} catch (IOException ioe) {
- logger.warn("Could not open web browser: ", ioe);
- return false;
+ JOptionPane.showInputDialog(null, "There was an error
while attempting to open the system browser. "
+ + "Please copy and paste the following
URL into your browser:", url);
+ logger.info("Error opening system browser; displaying
copyable link instead");
} catch (URISyntaxException e) {
logger.warn("This URI is invalid: " + url, e);
return false;
}
+
return true;
}
}
--
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.