📄 pathitem.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: PathItem.java
package org.gudy.azureus2.ui.swt.views.tableitems.files;
import java.io.File;
import java.io.IOException;
import org.gudy.azureus2.core3.disk.DiskManagerFileInfo;
import org.gudy.azureus2.core3.download.DownloadManager;
import org.gudy.azureus2.core3.torrent.TOTorrent;
import org.gudy.azureus2.plugins.ui.tables.*;
import org.gudy.azureus2.ui.swt.views.FilesView;
import org.gudy.azureus2.ui.swt.views.table.utils.CoreTableColumn;
public class PathItem extends CoreTableColumn
implements TableCellRefreshListener
{
public PathItem()
{
super("path", 1, -2, 200, "Files");
}
public void fillTableColumnInfo(TableColumnInfo info)
{
info.addCategories(new String[] {
"content"
});
}
public void refresh(TableCell cell)
{
DiskManagerFileInfo fileInfo = (DiskManagerFileInfo)cell.getDataSource();
cell.setText(determinePath(fileInfo));
}
private static String determinePath(DiskManagerFileInfo fileInfo)
{
if (fileInfo == null)
return "";
boolean has_link = fileInfo.getLink() != null;
boolean show_full_path = FilesView.show_full_path;
DownloadManager dm = fileInfo.getDownloadManager();
File dl_save_path_file = dm.getAbsoluteSaveLocation();
TOTorrent torrent = dm.getTorrent();
if (torrent != null && torrent.isSimpleTorrent())
dl_save_path_file = dl_save_path_file.getParentFile();
String dl_save_path = dl_save_path_file.getPath();
if (!dl_save_path.endsWith(File.separator))
dl_save_path = (new StringBuilder()).append(dl_save_path).append(File.separator).toString();
File file = fileInfo.getFile(true);
if (has_link && !show_full_path)
show_full_path = !file.getAbsolutePath().startsWith(dl_save_path);
String path = "";
if (show_full_path)
{
try
{
path = file.getParentFile().getCanonicalPath();
}
catch (IOException e)
{
path = file.getParentFile().getAbsolutePath();
}
if (!path.endsWith(File.separator))
path = (new StringBuilder()).append(path).append(File.separator).toString();
} else
{
path = file.getAbsolutePath().substring(dl_save_path.length());
if (path.length() == 0)
{
path = File.separator;
} else
{
if (path.charAt(0) == File.separatorChar)
path = path.substring(1);
int pos = path.lastIndexOf(File.separator);
if (pos > 0)
path = (new StringBuilder()).append(File.separator).append(path.substring(0, pos)).toString();
else
path = File.separator;
}
}
return path;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -