public void addLinkHandler(String commandId, ILinkHandler handler) {
fLinkHandler.put(commandId, handler);
}
private Browser createBrowser(Composite parent, int style) {
Browser browser = null;
/* Properly configure Proxy for Firefox/XULRunner if required */
if (Application.IS_LINUX || (useMozilla())) {
String proxyHost = fEclipsePreferences.getString(DefaultPreferences.ECLIPSE_PROXY_HOST);
String proxyPort = fEclipsePreferences.getString(DefaultPreferences.ECLIPSE_PROXY_PORT);
if (useProxy() && StringUtils.isSet(proxyHost) && StringUtils.isSet(proxyPort)) {
System.setProperty(XULRUNNER_PROXY_HOST, proxyHost);
System.setProperty(XULRUNNER_PROXY_PORT, proxyPort);
} else {
System.setProperty(XULRUNNER_PROXY_HOST, ""); //$NON-NLS-1$
System.setProperty(XULRUNNER_PROXY_PORT, ""); //$NON-NLS-1$
}
}
/* Try Mozilla over IE on Windows */
if (useMozilla()) {
try {
browser = new Browser(parent, style | SWT.MOZILLA);
fgMozillaRunningOnWindows = true;
} catch (SWTError e) {
fgMozillaAvailable = false;
if (!"No more handles [Could not detect registered XULRunner to use]".equals(e.getMessage())) //This happens too often to log it //$NON-NLS-1$
Activator.getDefault().getLog().log(Activator.getDefault().createInfoStatus(e.getMessage(), null));
}
}
/* Any other OS, or Mozilla unavailable, use default */
if (browser == null)
browser = new Browser(parent, style);
/* Add Focusless Scroll Hook on Windows */
if (Application.IS_WINDOWS)
browser.setData(ApplicationWorkbenchWindowAdvisor.FOCUSLESS_SCROLL_HOOK, true);
/* Disable IE Navigation Sound (Windows Only) */
Method method = null;
if (!fgNavigationSoundsDisabled) {
method = callCoInternetSetFeatureEnabled(method, FEATURE_DISABLE_NAVIGATION_SOUNDS, SET_FEATURE_ON_PROCESS, true);
fgNavigationSoundsDisabled = true;
}
/* Set Popupblocker if necessary */
if (Application.IS_WINDOWS) {
boolean prefEnablePopupBlocker = fPreferences.getBoolean(DefaultPreferences.ENABLE_IE_POPUP_BLOCKER);
if (prefEnablePopupBlocker != fgPopupBlockerEnabled) {
method = callCoInternetSetFeatureEnabled(method, FEATURE_WEBOC_POPUPMANAGEMENT, SET_FEATURE_ON_PROCESS, prefEnablePopupBlocker);
callCoInternetSetFeatureEnabled(method, FEATURE_SECURITYBAND, SET_FEATURE_ON_PROCESS, prefEnablePopupBlocker);
fgPopupBlockerEnabled = prefEnablePopupBlocker;
}
}
/* Clear all Link Handlers upon disposal */
browser.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
fLinkHandler.clear();
}
});