📄 mytrackerview.java
字号:
}
if (itemKey.equals("stop"))
{
stopSelectedTorrents();
return;
}
if (itemKey.equals("remove"))
{
removeSelectedTorrents();
return;
} else
{
return;
}
}
private void stopSelectedTorrents()
{
tv.runForSelectedRows(new TableGroupRowRunner() {
final MyTrackerView this$0;
public void run(TableRowCore row)
{
TRHostTorrent torrent = (TRHostTorrent)row.getDataSource(true);
if (torrent.getStatus() == 2)
torrent.stop();
}
{
this$0 = MyTrackerView.this;
super();
}
});
}
private void startSelectedTorrents()
{
tv.runForSelectedRows(new TableGroupRowRunner() {
final MyTrackerView this$0;
public void run(TableRowCore row)
{
TRHostTorrent torrent = (TRHostTorrent)row.getDataSource(true);
if (torrent.getStatus() == 1)
torrent.start();
}
{
this$0 = MyTrackerView.this;
super();
}
});
}
private void removeSelectedTorrents()
{
tv.runForSelectedRows(new TableGroupRowRunner() {
final MyTrackerView this$0;
public void run(TableRowCore row)
{
TRHostTorrent torrent = (TRHostTorrent)row.getDataSource(true);
try
{
torrent.remove();
}
catch (TRHostTorrentRemovalVetoException f)
{
Alerts.showErrorMessageBoxUsingResourceString(new Object[] {
torrent
}, "globalmanager.download.remove.veto", f, 0);
}
}
{
this$0 = MyTrackerView.this;
super();
}
});
}
private void addCategorySubMenu()
{
MenuItem items[] = menuCategory.getItems();
for (int i = 0; i < items.length; i++)
items[i].dispose();
Category categories[] = CategoryManager.getCategories();
Arrays.sort(categories);
if (categories.length > 0)
{
Category catUncat = CategoryManager.getCategory(2);
if (catUncat != null)
{
MenuItem itemCategory = new MenuItem(menuCategory, 8);
Messages.setLanguageText(itemCategory, catUncat.getName());
itemCategory.setData("Category", catUncat);
itemCategory.addListener(13, new Listener() {
final MyTrackerView this$0;
public void handleEvent(Event event)
{
MenuItem item = (MenuItem)event.widget;
assignSelectedToCategory((Category)item.getData("Category"));
}
{
this$0 = MyTrackerView.this;
super();
}
});
new MenuItem(menuCategory, 2);
}
for (int i = 0; i < categories.length; i++)
if (categories[i].getType() == 0)
{
MenuItem itemCategory = new MenuItem(menuCategory, 8);
itemCategory.setText(categories[i].getName());
itemCategory.setData("Category", categories[i]);
itemCategory.addListener(13, new Listener() {
final MyTrackerView this$0;
public void handleEvent(Event event)
{
MenuItem item = (MenuItem)event.widget;
assignSelectedToCategory((Category)item.getData("Category"));
}
{
this$0 = MyTrackerView.this;
super();
}
});
}
new MenuItem(menuCategory, 2);
}
MenuItem itemAddCategory = new MenuItem(menuCategory, 8);
Messages.setLanguageText(itemAddCategory, "MyTorrentsView.menu.setCategory.add");
itemAddCategory.addListener(13, new Listener() {
final MyTrackerView this$0;
public void handleEvent(Event event)
{
addCategory();
}
{
this$0 = MyTrackerView.this;
super();
}
});
}
public void categoryAdded(Category category)
{
Utils.execSWTThread(new AERunnable() {
final MyTrackerView this$0;
public void runSupport()
{
addCategorySubMenu();
}
{
this$0 = MyTrackerView.this;
super();
}
});
}
public void categoryRemoved(Category category)
{
Utils.execSWTThread(new AERunnable() {
final MyTrackerView this$0;
public void runSupport()
{
addCategorySubMenu();
}
{
this$0 = MyTrackerView.this;
super();
}
});
}
private void addCategory()
{
CategoryAdderWindow adderWindow = new CategoryAdderWindow(SWTThread.getInstance().getDisplay());
Category newCategory = adderWindow.getNewCategory();
if (newCategory != null)
assignSelectedToCategory(newCategory);
}
private void assignSelectedToCategory(final Category category)
{
tv.runForSelectedRows(new TableGroupRowRunner() {
final Category val$category;
final MyTrackerView this$0;
public void run(TableRowCore row)
{
TRHostTorrent tr_torrent = (TRHostTorrent)row.getDataSource(true);
org.gudy.azureus2.core3.torrent.TOTorrent torrent = tr_torrent.getTorrent();
DownloadManager dm = azureus_core.getGlobalManager().getDownloadManager(torrent);
if (dm != null)
{
dm.getDownloadState().setCategory(category);
} else
{
String cat_str;
if (category == null)
cat_str = null;
else
if (category == CategoryManager.getCategory(2))
cat_str = null;
else
cat_str = category.getName();
TorrentUtils.setPluginStringProperty(torrent, "azcoreplugins.category", cat_str);
try
{
TorrentUtils.writeToFile(torrent);
}
catch (Throwable e)
{
Debug.printStackTrace(e);
}
}
}
{
this$0 = MyTrackerView.this;
category = category1;
super();
}
});
}
public void deselected(TableRowCore rows[])
{
computePossibleActions();
UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions();
if (uiFunctions != null)
uiFunctions.refreshIconBar();
}
public void focusChanged(TableRowCore focus)
{
computePossibleActions();
UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions();
if (uiFunctions != null)
uiFunctions.refreshIconBar();
}
public void selected(TableRowCore rows[])
{
computePossibleActions();
UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions();
if (uiFunctions != null)
uiFunctions.refreshIconBar();
}
public void mouseEnter(TableRowCore tablerowcore)
{
}
public void mouseExit(TableRowCore tablerowcore)
{
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -