Author: yradtsevich
Date: 2012-01-24 12:37:13 -0500 (Tue, 24 Jan 2012)
New Revision: 38110
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java
Log:
https://issues.jboss.org/browse/JBIDE-10555 : Browsersim should have a "open in
default browser" action
- added validation of URL (to do not open 'about:blank' and similar)
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java 2012-01-24
17:05:34 UTC (rev 38109)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java 2012-01-24
17:37:13 UTC (rev 38110)
@@ -13,6 +13,7 @@
import java.awt.Desktop;
import java.net.URI;
import java.net.URISyntaxException;
+import java.net.URL;
import java.util.List;
import java.util.Observable;
import java.util.Observer;
@@ -302,7 +303,8 @@
openInDefaultBrowser.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
try {
- Desktop.getDesktop().browse(new URI(skin.getBrowser().getUrl()));
+ URL url = new URL(skin.getBrowser().getUrl()); // validate URL (to do not open
'about:blank' and similar)
+ Desktop.getDesktop().browse(url.toURI());
} catch (Exception e1) {
showErrorMessage(skin.getShell(),
Messages.BrowserSim_COULD_NOT_OPEN_DEFAULT_BROWSER + e1.getMessage());
}