if (mainBrowser != null && !mainBrowser.isDisposed()) {
return;
}
try{
mainBrowser = new Browser(composite,Utils.getInitialBrowserStyle(SWT.NONE));
mainBrowser.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
((Browser)e.widget).setUrl("about:blank");
((Browser)e.widget).setVisible(false);
while (!e.display.isDisposed() && e.display.readAndDispatch());
}
});
BrowserContext context =
new BrowserContext("browser-window" + Math.random(), mainBrowser, null, true);
context.addListener(new BrowserContext.loadingListener(){
public void browserLoadingChanged(boolean loading, String url) {
if (mdiInfo.spinnerImage != null) {
mdiInfo.spinnerImage.setVisible(loading);
}
}
});
context.addMessageListener(new TorrentListener());
context.addMessageListener(new VuzeListener());
context.addMessageListener(new DisplayListener(mainBrowser));
context.addMessageListener(new ConfigListener(mainBrowser));
context.addMessageListener(
new MetaSearchListener( this ));
ContentNetwork contentNetwork = ContentNetworkManagerFactory.getSingleton().getContentNetwork(
context.getContentNetworkID());
// contentNetwork won't be null because a new browser context
// has the default content network
String url = contentNetwork.getSubscriptionURL(subs.getID());
Boolean edit_mode = (Boolean)subs.getUserData( SubscriptionManagerUI.SUB_EDIT_MODE_KEY );
if ( edit_mode != null ){
if ( edit_mode.booleanValue()){
url += SubscriptionManagerUI.EDIT_MODE_MARKER;
}
subs.setUserData( SubscriptionManagerUI.SUB_EDIT_MODE_KEY, null );
}
mainBrowser.setUrl(url);
mainBrowser.setData("StartURL", url);
FormData data = new FormData();
data.left = new FormAttachment(0,0);
data.right = new FormAttachment(100,0);
data.top = new FormAttachment(composite,0);
data.bottom = new FormAttachment(100,0);
mainBrowser.setLayoutData(data);
detailsBrowser = new Browser(composite,Utils.getInitialBrowserStyle(SWT.NONE));
detailsBrowser.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
((Browser)e.widget).setUrl("about:blank");
((Browser)e.widget).setVisible(false);
while (!e.display.isDisposed() && e.display.readAndDispatch());
}