|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2000, 2011 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2013 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 13-20
Link Here
|
| 13 |
|
13 |
|
| 14 |
import java.io.IOException; |
14 |
import java.io.IOException; |
| 15 |
import java.net.URL; |
15 |
import java.net.URL; |
|
|
16 |
import java.util.StringTokenizer; |
| 16 |
|
17 |
|
| 17 |
import org.eclipse.core.runtime.Platform; |
18 |
import org.eclipse.core.runtime.Platform; |
|
|
19 |
|
| 18 |
import org.eclipse.ui.browser.AbstractWebBrowser; |
20 |
import org.eclipse.ui.browser.AbstractWebBrowser; |
| 19 |
import org.eclipse.ui.internal.browser.WebBrowserUIPlugin; |
21 |
import org.eclipse.ui.internal.browser.WebBrowserUIPlugin; |
| 20 |
import org.eclipse.ui.internal.browser.WebBrowserUtil; |
22 |
import org.eclipse.ui.internal.browser.WebBrowserUtil; |
|
Lines 86-97
Link Here
|
| 86 |
} |
88 |
} |
| 87 |
|
89 |
|
| 88 |
/** |
90 |
/** |
| 89 |
* @param browserCmd |
91 |
* @param command the command |
|
|
92 |
* @param parameters the parameters |
| 90 |
* @return int 0 if success |
93 |
* @return int 0 if success |
| 91 |
*/ |
94 |
*/ |
| 92 |
private int openBrowser(String browserCmd) { |
95 |
private int openBrowser(String command, String parameters) { |
| 93 |
try { |
96 |
try { |
| 94 |
Process pr = Runtime.getRuntime().exec(browserCmd); |
97 |
StringTokenizer tokenizer = new StringTokenizer(parameters); |
|
|
98 |
String[] commandArray = new String[tokenizer.countTokens() + 1]; |
| 99 |
commandArray[0] = command; |
| 100 |
for (int i= 1; tokenizer.hasMoreTokens(); i++) |
| 101 |
commandArray[i] = tokenizer.nextToken(); |
| 102 |
|
| 103 |
Process pr = Runtime.getRuntime().exec(commandArray); |
| 95 |
StreamConsumer outputs = new StreamConsumer(pr.getInputStream()); |
104 |
StreamConsumer outputs = new StreamConsumer(pr.getInputStream()); |
| 96 |
(outputs).start(); |
105 |
(outputs).start(); |
| 97 |
StreamConsumer errors = new StreamConsumer(pr.getErrorStream()); |
106 |
StreamConsumer errors = new StreamConsumer(pr.getErrorStream()); |
|
Lines 162-180
Link Here
|
| 162 |
if (exitRequested) |
171 |
if (exitRequested) |
| 163 |
return; |
172 |
return; |
| 164 |
if (firstLaunch && Platform.OS_WIN32.equals(Platform.getOS())) { |
173 |
if (firstLaunch && Platform.OS_WIN32.equals(Platform.getOS())) { |
| 165 |
if (openBrowser(executable + " " + WebBrowserUtil.createParameterString(parameters, url)) == 0) //$NON-NLS-1$ |
174 |
if (openBrowser(executable, WebBrowserUtil.createParameterString(parameters, url)) == 0) |
| 166 |
return; |
175 |
return; |
| 167 |
browserFullyOpenedAt = System.currentTimeMillis() + DELAY; |
176 |
browserFullyOpenedAt = System.currentTimeMillis() + DELAY; |
| 168 |
return; |
177 |
return; |
| 169 |
} |
178 |
} |
| 170 |
if (openBrowser(executable + ' ' + parameters + " -remote openURL(" + url + ")") //$NON-NLS-1$ //$NON-NLS-2$ |
179 |
if (openBrowser(executable, parameters + " -remote openURL(" + url + ")") //$NON-NLS-1$ //$NON-NLS-2$ |
| 171 |
== 0) |
180 |
== 0) |
| 172 |
return; |
181 |
return; |
| 173 |
|
182 |
|
| 174 |
if (exitRequested) |
183 |
if (exitRequested) |
| 175 |
return; |
184 |
return; |
| 176 |
browserFullyOpenedAt = System.currentTimeMillis() + DELAY; |
185 |
browserFullyOpenedAt = System.currentTimeMillis() + DELAY; |
| 177 |
openBrowser(executable + " " + WebBrowserUtil.createParameterString(parameters, url)); //$NON-NLS-1$ |
186 |
openBrowser(executable, WebBrowserUtil.createParameterString(parameters, url)); |
| 178 |
} |
187 |
} |
| 179 |
|
188 |
|
| 180 |
private void waitForBrowser() { |
189 |
private void waitForBrowser() { |