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 TableView view;
19 private final Table table;
20 public CopyAction(TableView view, Table table) {
26 TableItem items[] = table.getSelection();
27 StringBuffer text = new StringBuffer();
28 for (int i = 0; i < items.length; i++) {
29 int columns = table.getColumnCount();
30 for (int col = 0; col < columns; col++) {
31 text.append(items[i].getText(col));
36 QuantumPlugin.getDefault().getSysClip().setContents(
37 new Object[] { text.toString()},
38 new Transfer[] { TextTransfer.getInstance()});