2 * Created on 28-jul-2003
5 package com.quantum.view;
7 import com.quantum.QuantumPlugin;
8 import com.quantum.view.tableview.TableView;
10 import org.eclipse.jface.action.Action;
11 import org.eclipse.swt.dnd.TextTransfer;
12 import org.eclipse.swt.dnd.Transfer;
13 import org.eclipse.swt.widgets.Table;
14 import org.eclipse.swt.widgets.TableItem;
17 public final class CopyAction extends Action {
18 private final Table table;
19 public CopyAction(TableView view, Table table) {
24 TableItem items[] = table.getSelection();
25 StringBuffer text = new StringBuffer();
26 for (int i = 0; i < items.length; i++) {
27 int columns = table.getColumnCount();
28 for (int col = 0; col < columns; col++) {
29 text.append(items[i].getText(col));
34 QuantumPlugin.getDefault().getSysClip().setContents(
35 new Object[] { text.toString()},
36 new Transfer[] { TextTransfer.getInstance()});