cell.getTableRow().setData("text", sb.toString());
}
// @see org.gudy.azureus2.plugins.ui.tables.TableCellMouseListener#cellMouseTrigger(org.gudy.azureus2.plugins.ui.tables.TableCellMouseEvent)
public void cellMouseTrigger(TableCellMouseEvent event) {
VuzeActivitiesEntry entry = (VuzeActivitiesEntry) event.cell.getDataSource();
String tooltip = null;
boolean invalidateAndRefresh = false;
Rectangle bounds = ((TableCellSWT) event.cell).getBounds();
String text = (String) event.cell.getTableRow().getData("text");
if (text == null) {
return;
}
GCStringPrinter sp = null;
GC gc = new GC(Display.getDefault());
try {
if (font != null) {
gc.setFont(font);
}
Rectangle drawBounds = getDrawBounds((TableCellSWT) event.cell);
sp = new GCStringPrinter(gc, text, drawBounds, true, true, SWT.WRAP
| SWT.CENTER);
sp.calculateMetrics();
} catch (Exception e) {
Debug.out(e);
} finally {
gc.dispose();
}
if (sp != null) {
URLInfo hitUrl = sp.getHitUrl(event.x + bounds.x, event.y + bounds.y);
int newCursor;
if (hitUrl != null) {
if (event.eventType == TableCellMouseEvent.EVENT_MOUSEUP) {
if (hitUrl.url.equals("download")) {
String referal = null;
Object ds = event.cell.getDataSource();
if (ds instanceof VuzeActivitiesEntry) {
referal = DLReferals.DL_REFERAL_DASHACTIVITY + "-"
+ ((VuzeActivitiesEntry) ds).getTypeID();
}
TorrentListViewsUtils.downloadDataSource(ds, false, referal);
} else if (hitUrl.url.equals("play")) {
String referal = null;
Object ds = event.cell.getDataSource();
if (ds instanceof VuzeActivitiesEntry) {
referal = DLReferals.DL_REFERAL_PLAYDASHACTIVITY + "-"
+ ((VuzeActivitiesEntry) ds).getTypeID();
}
TorrentListViewsUtils.playOrStreamDataSource(ds, referal, false, true );
} else if (hitUrl.url.equals("launch")) {
// run via play or stream so we get the security warning
Object ds = event.cell.getDataSource();
TorrentListViewsUtils.playOrStreamDataSource(ds,
DLReferals.DL_REFERAL_LAUNCH, false, true);
} else if (!UrlFilter.getInstance().urlCanRPC(hitUrl.url)) {
Utils.launch(hitUrl.url);
} else {
UIFunctionsSWT uif = UIFunctionsManagerSWT.getUIFunctionsSWT();
if (uif != null) {
String target = hitUrl.target;
if (target == null) {
target = ContentNetworkUtils.getTarget(entry.getContentNetwork());
}
uif.viewURL(hitUrl.url, target, "column.activity.action");
return;
}
}