});
}
private void onMouseDown(Event event) {
Point p = new Point(event.x, event.y);
TableItem item = fResultViewer.getTable().getItem(p);
/* Problem - return */
if (item == null || item.isDisposed())
return;
/* Mouse-Up over Read-State-Column */
if (event.button == 1 && isInImageBounds(item, NewsColumn.TITLE, p)) {
Object data = item.getData();
/* Toggle State between Read / Unread */
if (data instanceof ScoredNews) {
INews news = ((ScoredNews) data).getNews();
INews.State newState = (news.getState() == INews.State.READ) ? INews.State.UNREAD : INews.State.READ;
setNewsState(new ArrayList<INews>(Arrays.asList(new INews[] { news })), newState);
fLastColumnActionInvokedMillies = System.currentTimeMillis();
}
}
/* Mouse-Up over Sticky-State-Column */
else if (event.button == 1 && isInImageBounds(item, NewsColumn.STICKY, p)) {
Object data = item.getData();
/* Toggle State between Sticky / Not Sticky */
if (data instanceof ScoredNews) {
new MakeNewsStickyAction(new StructuredSelection(((ScoredNews) data).getNews())).run();
fLastColumnActionInvokedMillies = System.currentTimeMillis();
}
}
/* Mouse-Up over Attachments-Column */
else if (event.button == 1 && isInImageBounds(item, NewsColumn.ATTACHMENTS, p)) {
Object data = item.getData();
if (data instanceof ScoredNews) {
MenuManager contextMenu = new MenuManager();
ApplicationActionBarAdvisor.fillAttachmentsMenu(contextMenu, new StructuredSelection(((ScoredNews) data).getNews()), this, true);
if (fAttachmentsMenu != null)
fAttachmentsMenu.dispose();
fAttachmentsMenu = contextMenu.createContextMenu(fResultViewer.getControl());
Point cursorLocation = item.getDisplay().getCursorLocation();
cursorLocation.y = cursorLocation.y + 16;
fAttachmentsMenu.setLocation(cursorLocation);
fAttachmentsMenu.setVisible(true);
fLastColumnActionInvokedMillies = System.currentTimeMillis();