* @param table {@link JTable}
*/
protected void addFromClipboard(JTable table) {
GuiUtils.stopTableEditing(table);
int rowCount = table.getRowCount();
PowerTableModel model = null;
try {
String clipboardContent = GuiUtils.getPastedText();
if (clipboardContent != null) {
String[] clipboardLines = clipboardContent.split(NEW_LINE);
for (String clipboardLine : clipboardLines) {
model = (PowerTableModel) table.getModel();
model.addRow(new Object[] {clipboardLine});
}
if (table.getRowCount() > rowCount) {
if(model != null) {
// Highlight (select) the appropriate rows.
int rowToSelect = model.getRowCount() - 1;
table.setRowSelectionInterval(rowCount, rowToSelect);
}
}
}
} catch (IOException ioe) {