Methods Summary |
---|
protected final void | addTableToFocusListener(org.eclipse.swt.widgets.Table table, int colStart, int colEnd)Sets up a Table object to notify the global Table Focus listener when it
gets or loses the focus.
// create the activator for this table
final IFocusedTableActivator activator = new IFocusedTableActivator() {
public void copy(Clipboard clipboard) {
int[] selection = table.getSelectionIndices();
// we need to sort the items to be sure.
Arrays.sort(selection);
// all lines must be concatenated.
StringBuilder sb = new StringBuilder();
// loop on the selection and output the file.
for (int i : selection) {
TableItem item = table.getItem(i);
for (int c = colStart ; c <= colEnd ; c++) {
sb.append(item.getText(c));
sb.append('\t");
}
sb.append('\n");
}
// now add that to the clipboard if the string has content
String data = sb.toString();
if (data != null || data.length() > 0) {
clipboard.setContents(
new Object[] { data },
new Transfer[] { TextTransfer.getInstance() });
}
}
public void selectAll() {
table.selectAll();
}
};
// add the focus listener on the table to notify the global listener
table.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent e) {
mGlobalListener.focusGained(activator);
}
public void focusLost(FocusEvent e) {
mGlobalListener.focusLost(activator);
}
});
|
protected final void | addTableToFocusListener(org.eclipse.swt.widgets.Table table)Sets up a Table object to notify the global Table Focus listener when it
gets or loses the focus.
When the copy method is invoked, all columns are put in the clipboard, separated
by tabs
addTableToFocusListener(table, 0, table.getColumnCount()-1);
|
public final void | setTableFocusListener(ITableFocusListener listener)Sets a TableFocusListener which will be notified when one of the tables
gets or loses focus.
// record the global listener, to make sure table created after
// this call will still be setup.
mGlobalListener = listener;
setTableFocusListener();
|
protected void | setTableFocusListener()Sets up the Table of object of the panel to work with the global listener.
Default implementation does nothing.
|