1 11 12 package org.eclipse.debug.internal.ui.views.memory.renderings; 13 14 import java.util.ArrayList ; 15 16 import org.eclipse.jface.viewers.StructuredViewer; 17 import org.eclipse.swt.graphics.GC; 18 import org.eclipse.swt.printing.Printer; 19 import org.eclipse.swt.widgets.Table; 20 import org.eclipse.swt.widgets.TableItem; 21 22 26 public class AsyncPrintTableRenderingAction extends PrintTableRenderingAction { 27 28 public AsyncPrintTableRenderingAction(AbstractBaseTableRendering rendering, StructuredViewer viewer) { 29 super(rendering, viewer); 30 } 31 32 protected void printTable(TableItem[] itemList, GC printGC, Printer printer) { 33 Table table = null; 34 if (itemList.length > 0) 35 table = itemList[0].getParent(); 36 37 int topIndex = table.getTopIndex(); 38 int itemCount = table.getItemCount(); 39 int numVisibleLines = Math.min((table.getBounds().height / table.getItemHeight()) + 2, itemCount - topIndex); 40 41 ArrayList items = new ArrayList (); 42 43 for (int i=topIndex; i< topIndex + numVisibleLines; i++) 45 { 46 if (itemList[i].getData() != null) 47 { 48 items.add(itemList[i]); 49 } 50 else 51 break; 52 } 53 54 super.printTable((TableItem[])items.toArray(new TableItem[items.size()]), printGC, printer); 55 } 56 } 57 | Popular Tags |