Rectangle cellBounds = cell.getBounds();
int textX = cellBounds.x;
TableRowCore rowCore = cell.getTableRowCore();
if (rowCore != null) {
int numSubItems = rowCore.getSubItemCount();
int paddingX = 3;
int width = 7;
boolean show_twisty;
if ( NEVER_SHOW_TWISTY ){
show_twisty = false;
}else if (numSubItems > 1 ){
show_twisty = true;
}else{
Boolean show = (Boolean)rowCore.getData( ID_EXPANDOHITAREASHOW );
if ( show == null ){
DownloadManager dm = (DownloadManager)ds;
show_twisty = dm.getNumFileInfos() > 1;
rowCore.setData( ID_EXPANDOHITAREASHOW, new Boolean( show_twisty ));
}else{
show_twisty = show;
}
}
if (show_twisty) {
int middleY = cellBounds.y + (cellBounds.height / 2) - 1;
int startX = cellBounds.x + paddingX;
int halfHeight = 2;
Color bg = gc.getBackground();
gc.setBackground(gc.getForeground());
gc.setAntialias(SWT.ON);
gc.setAdvanced(true);
if (rowCore.isExpanded()) {
gc.fillPolygon(new int[] {
startX,
middleY - halfHeight,
startX + width,
middleY - halfHeight,
startX + (width / 2),
middleY + (halfHeight * 2) + 1
});
} else {
gc.fillPolygon(new int[] {
startX,
middleY - halfHeight,
startX + width,
middleY + halfHeight,
startX,
middleY + (halfHeight * 2) + 1
});
}
gc.setBackground(bg);
Rectangle hitArea = new Rectangle(paddingX, middleY - halfHeight
- cellBounds.y, width, (halfHeight * 4) + 1);
rowCore.setData(ID_EXPANDOHITAREA, hitArea);
cellBounds.x += paddingX * 2 + width;
cellBounds.width -= paddingX * 2 + width;
}
}