private String[] getItemText( TableItem row ) { if ( row.isDisposed() ) { return null; } String[] retval = new String[table.getColumnCount() - 1]; for ( int i = 0; i < retval.length; i++ ) { retval[i] = row.getText( i + 1 ); } return retval; }
if ( !row.isDisposed() ) { row.setText( colnr, value );
private void copyToAll() { TableItem row = activeTableItem; if ( row == null || row.isDisposed() ) { return; } int colnr = activeTableColumn; if ( colnr == 0 ) { return; } String str = row.getText( colnr ); // Get undo information: all columns int size = table.getItemCount(); String[][] before = new String[size][]; String[][] after = new String[size][]; int[] index = new int[size]; for ( int i = 0; i < table.getItemCount(); i++ ) { TableItem item = table.getItem( i ); index[i] = i; before[i] = getItemText( item ); item.setText( colnr, str ); after[i] = getItemText( item ); } // Add the undo information! TransAction ta = new TransAction(); ta.setChanged( before, after, index ); addUndo( ta ); }
@Override public void mouseDown( MouseEvent event ) { if ( activeTableItem != null && !activeTableItem.isDisposed() && editor != null && editor.getEditor() != null
@Override public void run() { if( index >= 0 && index < itemCount ) { TableItem item = _getItem( index ); if( !item.isDisposed() ) { Table.this.checkData( item, index ); } } } } );
public List<E> getSelectedItems() { TableItem ti[] = table.getSelection(); ArrayList<E> out = new ArrayList<>(ti.length); for (TableItem i : ti) { if (!i.isDisposed()) out.add((E) i.getData()); } return out; }
private void removeItem( int index ) { TableItem item = items[ index ]; if( item != null && !item.isDisposed() ) { item.dispose(); } else { destroyItem( null, index ); } }
/** * Sets the image to display in the given cell. * * @param item * the item to set the image of for this field * @param newImage * the Image to display in this field, of the given item */ public void setCellImage(final TableItem item, final Image newImage) { if (column.isVisible() && (!item.isDisposed())) { item.setImage(column.id, newImage); } }
/** * Sets the text to display in the given cell. * * @param item * the item to set the text of for this field * @param newText * the text to display in this field, of the given item */ public void setCellText(final TableItem item, final String newText) { if (column.isVisible() && (!item.isDisposed())) { item.setText(column.id, newText); } }
public void layout () { if (table == null || table.isDisposed()) return; if (item == null || item.isDisposed()) return; int columnCount = table.getColumnCount(); if (columnCount == 0 && column != 0) return; if (columnCount > 0 && (column < 0 || column >= columnCount)) return; super.layout(); } }
@Override public void layout () { if (table == null || table.isDisposed()) return; if (item == null || item.isDisposed()) return; int columnCount = table.getColumnCount(); if (columnCount == 0 && column != 0) return; if (columnCount > 0 && (column < 0 || column >= columnCount)) return; super.layout(); } }
public void layout () { if (table == null || table.isDisposed()) return; if (item == null || item.isDisposed()) return; int columnCount = table.getColumnCount(); if (columnCount == 0 && column != 0) return; if (columnCount > 0 && (column < 0 || column >= columnCount)) return; super.layout(); } }
@Override public void layout () { if (table == null || table.isDisposed()) return; if (item == null || item.isDisposed()) return; int columnCount = table.getColumnCount(); if (columnCount == 0 && column != 0) return; if (columnCount > 0 && (column < 0 || column >= columnCount)) return; super.layout(); } }
@Override public void layout () { if (table == null || table.isDisposed()) return; if (item == null || item.isDisposed()) return; int columnCount = table.getColumnCount(); if (columnCount == 0 && column != 0) return; if (columnCount > 0 && (column < 0 || column >= columnCount)) return; super.layout(); } }
@Override public void layout () { if (table == null || table.isDisposed()) return; if (item == null || item.isDisposed()) return; int columnCount = table.getColumnCount(); if (columnCount == 0 && column != 0) return; if (columnCount > 0 && (column < 0 || column >= columnCount)) return; super.layout(); } }
/** * Sets the image in the given cell to be the image that represents the given status. * * @param item * the item to set the image of for this field * @param newStatus * the status of the item, from which we will obtain the Image to display * in this field, of the given item */ public void setCellImage(final TableItem item, final ItemState newStatus) { if (column.isVisible() && (!item.isDisposed())) { item.setImage(column.id, newStatus.getIcon()); } }
@Override public int getCreationIndex(int visualIndex) { if( item != null && ! item.isDisposed() && hasColumns() && isValidOrderIndex(visualIndex) ) { return item.getParent().getColumnOrder()[visualIndex]; } return super.getCreationIndex(visualIndex); }
@Override public int getCreationIndex(int visualIndex) { if( item != null && ! item.isDisposed() && hasColumns() && isValidOrderIndex(visualIndex) ) { return item.getParent().getColumnOrder()[visualIndex]; } return super.getCreationIndex(visualIndex); }
public int getCreationIndex(int visualIndex) { if( item != null && ! item.isDisposed() && hasColumns() && isValidOrderIndex(visualIndex) ) { return item.getParent().getColumnOrder()[visualIndex]; } return super.getCreationIndex(visualIndex); }
private void run() { // restores the text of previous item if (prevItem != null && !prevItem.isDisposed()){ prevItem.setText(prevItemText); } TableItem[] items = componentTableViewer.getTable().getSelection(); Object component = items[0].getData(); prevItem = items[0]; prevItemText = items[0].getText(); // add clarification for the first selected item items[0].setText( descriptionProvider.getName(component) + " - " + descriptionProvider.getQualifier(component)); updateLocationView(component, descriptionProvider); } });