Opening a browser window via OpenAPI


I'm looking for a code snippet for opening up a browser window from within a plugin, similar to what's done by the "Generate Javadoc" or "Export to HTML" Actions. My use case is similar to those, as I'm using the PSI to generate static analysis/metrics/cross-reference reports as directories of HTML pages, and wish to pop up a browser with a top-level index file when done. Clearly this is doable via hacking with system properties and Runtime.exec, but if there is a 'blessed' way of doing so I'd love to see it.

Thanks.

--Dave Griffith

--Dave

0
4 comments
Avatar
Permanently deleted user

The following code will launch the default browser.

-


----



In fact, if you change the URL you can get it to launch the default email client (mailto:name@address) and also the default telnet client (telnet:address).

Works only for windows, tho.

HTH,

-sms

0
Avatar
Permanently deleted user

If you want to add support for Mac OS X, try the following:

0
Avatar
Permanently deleted user

you could also optionally utilize the docbrowser... it's fast and opens right in IDEA...

http://www.intellij.org/twiki/bin/view/Main/DocPlugin

0

Try this:

com.intellij.ide.BrowserUtil.launchBrowser("http://www.reddit.com");

0

Please sign in to leave a comment.