Methods Summary |
---|
public void | addSection(org.gudy.azureus2.ui.swt.pluginsimpl.UISWTViewImpl view)
Object pluginDataSource = null;
try {
pluginDataSource = DownloadManagerImpl.getDownloadStatic(manager);
} catch (DownloadException e) {
/* Ignore */
}
addSection(view, pluginDataSource);
|
private void | addSection(IView view, java.lang.Object dataSource)
if (view == null)
return;
view.dataSourceChanged(dataSource);
TabItem item = new TabItem(folder, SWT.NULL);
Messages.setLanguageText(item, view.getData());
item.setData("IView", view);
tabViews.add(view);
|
public void | completionChanged(org.gudy.azureus2.core3.download.DownloadManager manager, boolean bCompleted)
|
public void | dataSourceChanged(java.lang.Object newDataSource)
super.dataSourceChanged(newDataSource);
if (manager != null) {
manager.removeListener(this);
}
DownloadImpl dataSourcePlugin = null;
if (newDataSource instanceof DownloadImpl) {
dataSourcePlugin = (DownloadImpl) newDataSource;
manager = dataSourcePlugin.getDownload();
} else if (newDataSource instanceof DownloadManager) {
manager = (DownloadManager) newDataSource;
try {
dataSourcePlugin = DownloadManagerImpl.getDownloadStatic(manager);
} catch (DownloadException e) { /* Ignore */ }
} else {
manager = null;
}
if (manager != null) {
manager.addListener(this);
}
for (int i = 0; i < tabViews.size(); i++) {
IView view = (IView) tabViews.get(i);
if (view != null) {
if (view instanceof UISWTViewImpl) {
((UISWTViewImpl) view).dataSourceChanged(dataSourcePlugin);
} else {
view.dataSourceChanged(newDataSource);
}
}
}
|
public void | delete()
UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions();
if (uiFunctions != null) {
uiFunctions.removeManagerView(manager);
}
if (manager != null) {
manager.removeListener(this);
}
if ( !folder.isDisposed()){
folder.setSelection(0);
}
//Don't ask me why, but without this an exception is thrown further
// (in folder.dispose() )
//TODO : Investigate to see if it's a platform (OSX-Carbon) BUG, and report to SWT team.
if(Constants.isOSX) {
if(folder != null && !folder.isDisposed()) {
TabItem[] items = folder.getItems();
for(int i=0 ; i < items.length ; i++) {
if (!items[i].isDisposed())
items[i].dispose();
}
}
}
for (int i = 0; i < tabViews.size(); i++) {
IView view = (IView) tabViews.get(i);
if (view != null)
view.delete();
}
tabViews.clear();
if (folder != null && !folder.isDisposed()) {
folder.dispose();
}
|
public void | downloadComplete(org.gudy.azureus2.core3.download.DownloadManager manager)
|
protected static java.lang.String | escapeAccelerators(java.lang.String str)
if ( str == null ){
return( str );
}
return( str.replaceAll( "&", "&&" ));
|
public void | filePriorityChanged(org.gudy.azureus2.core3.download.DownloadManager download, org.gudy.azureus2.core3.disk.DiskManagerFileInfo file)
|
private IView | getActiveView()
int index = folder.getSelectionIndex();
if (index == -1) {
return null;
}
TabItem ti = folder.getItem(index);
if (ti.isDisposed()) {
return null;
}
return (IView) ti.getData("IView");
|
public Composite | getComposite()
return folder;
|
public org.gudy.azureus2.core3.download.DownloadManager | getDownload()return manager;
|
public java.lang.String | getFullTitle()
int completed = manager.getStats().getCompleted();
return DisplayFormatters.formatPercentFromThousands(completed) + " : " + manager.getDisplayName();
|
public java.lang.String | getObfusticatedHeader()
int completed = manager.getStats().getCompleted();
return DisplayFormatters.formatPercentFromThousands(completed) + " : " + manager;
|
public void | initialize(Composite composite)
if (folder == null) {
folder = new TabFolder(composite, SWT.LEFT);
} else {
System.out.println("ManagerView::initialize : folder isn't null !!!");
}
IView views[] = { new GeneralView(), new PeersView(),
new PeersGraphicView(), new PiecesView(), new FilesView(), new TorrentInfoView( manager ),
new TorrentOptionsView( manager ), new LoggerView() };
for (int i = 0; i < views.length; i++)
addSection(views[i], manager);
// Call plugin listeners
UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
if (uiFunctions != null) {
UISWTInstanceImpl pluginUI = uiFunctions.getSWTPluginInstanceImpl();
Map pluginViews = pluginUI == null ? null
: pluginUI.getViewListeners(UISWTInstance.VIEW_MYTORRENTS);
if (pluginViews != null) {
String[] sNames = (String[]) pluginViews.keySet().toArray(new String[0]);
for (int i = 0; i < sNames.length; i++) {
UISWTViewEventListener l = (UISWTViewEventListener) pluginViews.get(sNames[i]);
if (l != null) {
try {
UISWTViewImpl view = new UISWTViewImpl(
UISWTInstance.VIEW_MYTORRENTS, sNames[i], l);
addSection(view);
} catch (Exception e) {
// skip
}
}
}
}
}
// Initialize view when user selects it
folder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
TabItem item = (TabItem)e.item;
if (item != null && item.getControl() == null) {
IView view = (IView)item.getData("IView");
view.initialize(folder);
item.setControl(view.getComposite());
}
refresh();
}
});
views[0].initialize(folder);
folder.getItem(0).setControl(views[0].getComposite());
views[0].refresh();
views[0].getComposite().layout(true);
|
public boolean | isEnabled(java.lang.String itemKey)
if (itemKey.equals("run"))
return true;
if (itemKey.equals("start"))
return ManagerUtils.isStartable(manager);
if (itemKey.equals("stop"))
return ManagerUtils.isStopable(manager);
if (itemKey.equals("host"))
return true;
if (itemKey.equals("publish"))
return true;
if (itemKey.equals("remove"))
return true;
return false;
|
public void | itemActivated(java.lang.String itemKey)
if (itemKey.equals("run")) {
ManagerUtils.run(manager);
return;
}
if (itemKey.equals("start")) {
ManagerUtils.queue(manager, folder.getShell());
return;
}
if (itemKey.equals("stop")) {
ManagerUtils.stop(manager, folder.getShell());
return;
}
if (itemKey.equals("host")) {
ManagerUtils.host(azureus_core, manager, folder);
UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions();
if (uiFunctions != null) {
uiFunctions.showMyTracker();
}
return;
}
if (itemKey.equals("publish")) {
ManagerUtils.publish(azureus_core, manager, folder);
UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions();
if (uiFunctions != null) {
uiFunctions.showMyTracker();
}
return;
}
if (itemKey.equals("remove")) {
ManagerUtils.remove(manager, null, false, false);
}
|
public org.eclipse.swt.graphics.Image | obfusticatedImage(org.eclipse.swt.graphics.Image image, org.eclipse.swt.graphics.Point shellOffset)
IView view = getActiveView();
if (view instanceof ObfusticateImage) {
try {
((ObfusticateImage)view).obfusticatedImage(image, shellOffset);
} catch (Exception e) {
Debug.out("Obfusticating " + view, e);
}
}
return image;
|
public void | positionChanged(org.gudy.azureus2.core3.download.DownloadManager download, int oldPosition, int newPosition)
|
public void | refresh()
if (getComposite() == null || getComposite().isDisposed())
return;
try {
IView view = getActiveView();
if (view != null)
view.refresh();
TabItem[] items = folder.getItems();
for (int i = 0; i < items.length; i++) {
TabItem item = items[i];
view = (IView) item.getData("IView");
try {
if (item.isDisposed())
continue;
String lastTitle = item.getText();
String newTitle = view.getShortTitle();
if (lastTitle == null || !lastTitle.equals(newTitle)) {
item.setText(escapeAccelerators(newTitle));
}
String lastToolTip = item.getToolTipText();
String newToolTip = view.getFullTitle() + " " +
MessageText.getString("Tab.closeHint");
if (lastToolTip == null || !lastToolTip.equals(newToolTip)) {
item.setToolTipText(newToolTip);
}
}
catch (Exception e){
Debug.printStackTrace(e);
}
}
} catch (Exception e) {
Debug.printStackTrace(e);
}
|
public void | stateChanged(org.gudy.azureus2.core3.download.DownloadManager manager, int state)
if(folder == null || folder.isDisposed())
return;
Display display = folder.getDisplay();
if(display == null || display.isDisposed())
return;
Utils.execSWTThread(new AERunnable() {
public void runSupport() {
UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions();
if (uiFunctions != null) {
uiFunctions.refreshIconBar();
}
}
});
|