From 06bfdde572cae3a3319e1337272b70a288ee36ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerard=20Delma=CC=80s?= Date: Sat, 26 Jul 2014 04:15:41 +0200 Subject: [PATCH] cross platform support fixes #27 --- src/de/dreamlab/dash/DashLauncher.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/de/dreamlab/dash/DashLauncher.java b/src/de/dreamlab/dash/DashLauncher.java index a7a84c4..d5a7d0d 100644 --- a/src/de/dreamlab/dash/DashLauncher.java +++ b/src/de/dreamlab/dash/DashLauncher.java @@ -4,14 +4,13 @@ package de.dreamlab.dash; -import com.intellij.execution.ExecutionException; -import com.intellij.execution.configurations.GeneralCommandLine; -import com.intellij.execution.util.ExecUtil; import com.intellij.notification.Notification; import com.intellij.notification.NotificationType; import com.intellij.notification.Notifications; +import java.awt.Desktop; import java.io.UnsupportedEncodingException; +import java.net.URI; import java.net.URLEncoder; import java.util.Collection; @@ -54,17 +53,15 @@ public void search(Collection keywords, String query) } } - private void openUri(String uri) + private void openUri(String uriStr) { try { - final GeneralCommandLine commandLine = new GeneralCommandLine(ExecUtil.getOpenCommandPath()); - commandLine.addParameter(uri); - commandLine.createProcess(); - + Desktop desktop = Desktop.getDesktop(); + URI uri = new URI(uriStr); + desktop.browse(uri); } - catch ( ExecutionException e ) { + catch (Throwable e) { Notifications.Bus.notify(new Notification("Dash Plugin Error", "Dash Plugin Error", e.getMessage(), NotificationType.ERROR)); - return; } }