}
}
browserSkinObject = SWTSkinUtils.findBrowserSO(soMain);
final MultipleDocumentInterfaceSWT mdi = UIFunctionsManagerSWT.getUIFunctionsSWT().getMDISWT();
if (mdi != null) {
final MdiEntry entry = mdi.getEntryBySkinView(this);
if (entry != null) {
vitalityImage = entry.addVitalityImage("image.sidebar.vitality.dots");
vitalityImage.setVisible(false);
mdi.addListener(new MdiListener() {
long lastSelect = 0;
public void mdiEntrySelected(MdiEntry newEntry,
MdiEntry oldEntry) {
if (entry == newEntry) {
if (entry == oldEntry) {
if (lastSelect < SystemTime.getOffsetTime(-1000)) {
if (browserSkinObject != null) {
browserSkinObject.restart();
}
}
} else {
lastSelect = SystemTime.getCurrentTime();
}
}
}
});
}
}
browserSkinObject.addListener(new SWTSkinObjectListener() {
public Object eventOccured(SWTSkinObject skinObject, int eventType,
Object params) {
if (eventType == EVENT_SHOW) {
browserSkinObject.removeListener(this);
browserSkinObject.addListener(new BrowserContext.loadingListener() {
public void browserLoadingChanged(boolean loading, String url) {
if (vitalityImage != null) {
vitalityImage.setVisible(loading);
}
}
});
browserSkinObject.getContext().setContentNetworkID(contentNetwork.getID());
browserSkinObject.setStartURL(ContentNetworkUtils.getUrl(contentNetwork,
ContentNetwork.SERVICE_BIG_BROWSE));
}
return null;
}
});
PluginInterface pi = PluginInitializer.getDefaultInterface();
UIManager uim = pi.getUIManager();
MenuManager menuManager = uim.getMenuManager();
String menuID = "sidebar."
+ ContentNetworkUtils.getTarget(contentNetwork);
MenuItem item = menuManager.addMenuItem(menuID, "Button.reload");
item.addListener(new MenuItemListener() {
public void selected(MenuItem menu, Object target) {
browserSkinObject.refresh();
}
});
if (org.gudy.azureus2.core3.util.Constants.isCVSVersion()) {
MenuItem parent = menuManager.addMenuItem(menuID, "CVS Only");
parent.setStyle(MenuItem.STYLE_MENU);
MenuItem menuItem = menuManager.addMenuItem(parent, "Button.reset");
menuItem.addListener(new MenuItemListener() {
public void selected(MenuItem menu, Object target) {
browserSkinObject.getContext().executeInBrowser("sendMessage('display','reset-url', {});");
//browserSkinObject.restart();
}
});
menuItem = menuManager.addMenuItem(parent, "Tux RPC Test");
menuItem.addListener(new MenuItemListener() {
public void selected(MenuItem menu, Object target) {
browserSkinObject.setURL("c:\\test\\BrowserMessaging.html");
}
});
menuItem = menuManager.addMenuItem(parent, "URL..");
menuItem.addListener(new MenuItemListener() {
public void selected(MenuItem menu, Object target) {
SimpleTextEntryWindow entryWindow = new SimpleTextEntryWindow("", "!URL!");
entryWindow.prompt(new UIInputReceiverListener() {
public void UIInputReceiverClosed(UIInputReceiver entryWindow) {
if (entryWindow.hasSubmittedInput()) {
browserSkinObject.setURL(entryWindow.getSubmittedInput());
}
}
});
}
});
if (contentNetwork != ConstantsVuze.getDefaultContentNetwork()) {
menuItem = menuManager.addMenuItem(parent, "Remove HD Network");
menuItem.addListener(new MenuItemListener() {
public void selected(MenuItem menu, Object target) {
if (mdi != null) {
MdiEntry entry = mdi.getEntryBySkinView(Browse.this);
if (entry != null) {
entry.removeListener(Browse.this);
}
mdi.closeEntry(ContentNetworkUtils.getTarget(contentNetwork));
}
contentNetwork.remove();
}
});
menuItem = menuManager.addMenuItem(parent, "Reset IP Flag && Close");
menuItem.addListener(new MenuItemListener() {
public void selected(MenuItem menu, Object target) {
contentNetwork.setPersistentProperty(
ContentNetwork.PP_AUTH_PAGE_SHOWN, Boolean.FALSE);
if (mdi != null) {
MdiEntry entry = mdi.getEntryBySkinView(Browse.this);
if (entry != null) {
entry.removeListener(Browse.this);
}
mdi.closeEntry(ContentNetworkUtils.getTarget(contentNetwork));
}
}
});
}
menuItem = menuManager.addMenuItem(parent, "Source Ref: "