protected void endTableEdit(TableCursor tableCursor, ControlEditor editor, final CommitEditRunnable commitEditRunnable, TableItem row, int column, String newValue) throws Exception { if (commitEditRunnable == null) { return; } commitEditRunnable.setTableCursor(tableCursor); commitEditRunnable.setEditor(editor); commitEditRunnable.setRow(row); commitEditRunnable.setColumn(column); commitEditRunnable.setNewValue(newValue); BusyIndicator.showWhile(row.getDisplay(), commitEditRunnable); Exception error = commitEditRunnable.getError(); if (error != null) { throw error; } }
private void selectAllInTable(TableViewer debugDataViewer, TableCursor tableCursor){ Table table = debugDataViewer.getTable(); TableItem[] tableItems = table.getItems(); int recordCount = 0; for(int rowIndex = 0; rowIndex < tableItems.length; rowIndex++){ TableItem tableItem = tableItems[rowIndex]; for(int colIndex = 1; colIndex <= table.getColumnCount(); colIndex++){ if(StringUtils.containsIgnoreCase(tableItem.getText(colIndex), findText.getText())){ label.setVisible(false); tableItem.setBackground(colIndex, Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY)); recordCount++; } } findColIndex=1; } findRowIndex = 0; findColIndex = 0; if(recordCount > 0){ label.setVisible(true); label.setText("Match count - " + recordCount); }else{ label.setVisible(false); } }
private void forwardTableTraverse(TableViewer debugDataViewer, TableCursor tableCursor){ TableItem previousSelectedTableItem = null; if(debugDataViewer.getData("SELECTED_ROW_INDEX")!=null){ previousSelectedTableItem = debugDataViewer.getTable().getItem((int) debugDataViewer.getData("SELECTED_ROW_INDEX")); findColIndex++; } Table table = debugDataViewer.getTable(); TableItem[] tableItems = table.getItems(); if(findColIndex == prevColSelection && findRowIndex == prevRowSelection){ findColIndex++; } if(findRowIndex < 0){ findRowIndex = 0; } for(;findRowIndex<tableItems.length;){ TableItem tableItem = tableItems[findRowIndex]; for(;findColIndex <= table.getColumnCount();findColIndex++){ if(StringUtils.containsIgnoreCase(tableItem.getText(findColIndex), findText.getText())){ if(prevColSelection > 0){ previousSelectedTableItem.setBackground(prevColSelection, Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); } label.setVisible(false); table.showItem(tableItem); table.showColumn(table.getColumn(findColIndex)); tableCursor.setSelection(findRowIndex, findColIndex); tableCursor.setVisible(false); tableItem.setBackground(findColIndex, Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY)); debugDataViewer.setData("SELECTED_ROW_INDEX", findRowIndex); debugDataViewer.setData("SEELCTED_COLUMN_INDEX", findColIndex); prevColSelection = findColIndex; return; } } findRowIndex++; findColIndex=1; if(findRowIndex >= tableItems.length){ findRowIndex = 0;} } }
private void reverseTableTraverse(TableViewer debugDataViewer, TableCursor tableCursor){ TableItem previousSelectedTableItem = null; if(debugDataViewer.getData("SELECTED_ROW_INDEX")!=null){ previousSelectedTableItem = debugDataViewer.getTable().getItem((int) debugDataViewer.getData("SELECTED_ROW_INDEX")); findColIndex -= 1; } if(findRowIndex < 0){ findRowIndex = debugDataViewer.getTable().getItems().length - 1; } Table table = debugDataViewer.getTable(); TableItem[] tableItems = table.getItems(); for(; findRowIndex >=0; findRowIndex--){ TableItem tableItem = tableItems[findRowIndex]; for( ; findColIndex > 0 ;findColIndex--){ if(StringUtils.containsIgnoreCase(tableItem.getText(findColIndex), findText.getText())){ if(prevColSelection > 0){ previousSelectedTableItem.setBackground(prevColSelection, Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); } label.setVisible(false); table.showItem(tableItem); table.showColumn(table.getColumn(findColIndex)); tableCursor.setSelection(findRowIndex, findColIndex); tableCursor.setVisible(false); tableItem.setBackground(findColIndex,Display.getDefault().getSystemColor(SWT.COLOR_DARK_GRAY)); if(findColIndex<=0){debugDataViewer.setData("SELECTED_ROW_INDEX", findRowIndex-1);}else{ debugDataViewer.setData("SELECTED_ROW_INDEX", findRowIndex); } debugDataViewer.setData("SEELCTED_COLUMN_INDEX", findColIndex); prevColSelection = findColIndex; prevRowSelection = findRowIndex; return ; } } if(findColIndex <= 0){ findColIndex = table.getColumnCount();} if(findRowIndex == 0){ findRowIndex = tableItems.length; } } }
static SelectionAdapter create(Widget widget) { if (widget instanceof Button) { return create((Button) widget); } else if (widget instanceof CCombo) { return create((CCombo) widget); } else if (widget instanceof Combo) { return create((Combo) widget); } else if (widget instanceof CoolItem) { return create((CoolItem) widget); } else if (widget instanceof CTabFolder) { return create((CTabFolder) widget); } else if (widget instanceof DateTime) { return create((DateTime) widget); } else if (widget instanceof Link) { return create((Link) widget); } else if (widget instanceof List) { return create((List) widget); } else if (widget instanceof MenuItem) { return create((MenuItem) widget); } else if (widget instanceof Sash) { return create((Sash) widget); } else if (widget instanceof Scale) { return create((Scale) widget); } else if (widget instanceof Slider) { return create((Slider) widget); } else if (widget instanceof Spinner) { return create((Spinner) widget); } else if (widget instanceof StyledText) { return create((StyledText) widget); } else if (widget instanceof TabFolder) { return create((TabFolder) widget); } else if (widget instanceof Table) { return create((Table) widget); } else if (widget instanceof TableColumn) { return create((TableColumn) widget); } else if (widget instanceof TableCursor) { return create((TableCursor) widget); } else if (widget instanceof Text) { return create((Text) widget); } else if (widget instanceof ToolItem) { return create((ToolItem) widget); } else if (widget instanceof ToolTip) { return create((ToolTip) widget); } else if (widget instanceof TrayItem) { return create((TrayItem) widget); } else if (widget instanceof Tree) { return create((Tree) widget); } else if (widget instanceof TreeColumn) { return create((TreeColumn) widget); } else if (widget instanceof TreeCursor) { return create((TreeCursor) widget); } throw new IllegalArgumentException("The given widget (" + widget.getClass().getName() + ") is not supported."); }
public TableCursor getTablecursor(){ return tableCursor; }
/** * @param tableViewer * @param cursor */ static void editCell(final TableViewer tableViewer, final TableCursor cursor) { tableViewer.editElement(cursor.getRow().getData(), cursor.getColumn()); // hide cursor only f there is an editor active on the cell cursor.setVisible(!tableViewer.isCellEditorActive()); }
/** * Returns the tableCursor. * * @return The tableCursor */ public TableCursor getTableCursor() { return _TableCursor; }
/** * Sets the tableCursor. * * @param tableCursor the tableCursor to set */ public void setTableCursor(TableCursor tableCursor) { _TableCursor = tableCursor; }
/** * If usesTableCursor was passed into the constructor then this will return * the table cursor. Otherwise it will return null. */ public TableCursor getTableCursor() { return cursor; }