/* * Created on 28-jul-2003 * */ package com.quantum.view; import com.quantum.QuantumPlugin; import com.quantum.view.tableview.TableView; import org.eclipse.jface.action.Action; import org.eclipse.swt.dnd.TextTransfer; import org.eclipse.swt.dnd.Transfer; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableItem; public final class CopyAction extends Action { private final Table table; public CopyAction(TableView view, Table table) { super(); this.table = table; } public void run() { TableItem items[] = table.getSelection(); StringBuffer text = new StringBuffer(); for (int i = 0; i < items.length; i++) { int columns = table.getColumnCount(); for (int col = 0; col < columns; col++) { text.append(items[i].getText(col)); text.append('\t'); } text.append('\n'); } QuantumPlugin.getDefault().getSysClip().setContents( new Object[] { text.toString()}, new Transfer[] { TextTransfer.getInstance()}); } }