use of org.eclipse.jface.viewers.ViewerRow in project cubrid-manager by CUBRID.
the class TableFocusCellManager method handleSelection.
/**
*
* Handle the selection event
*
* @param event Event
*/
private void handleSelection(Event event) {
if ((event.detail & SWT.CHECK) == 0 && focusCell != null && focusCell.getItem() != event.item && event.item != null && !event.item.isDisposed()) {
ViewerRow row = viewer.getViewerRowByItem(event.item);
ViewerCell tmp = row.getCell(focusCell.getColumnIndex());
if (!focusCell.equals(tmp)) {
setFocusCell(tmp);
}
}
}
use of org.eclipse.jface.viewers.ViewerRow in project cubrid-manager by CUBRID.
the class TableFocusCellManager method getInitialFocusCell.
/**
*
* Get the initial focus cell
*
* @return ViewerCell
*/
public ViewerCell getInitialFocusCell() {
Table table = (Table) getViewer().getControl();
if (!table.isDisposed() && table.getItemCount() > 0 && !table.getItem(table.getTopIndex()).isDisposed()) {
final ViewerRow aViewerRow = getViewer().getViewerRowByItem(table.getItem(table.getTopIndex()));
if (table.getColumnCount() == 0) {
return aViewerRow.getCell(0);
}
Rectangle clientArea = table.getClientArea();
for (int i = 0; i < table.getColumnCount(); i++) {
if (aViewerRow.getBounds(i).width > 0 && columnInVisibleArea(clientArea, aViewerRow, i))
return aViewerRow.getCell(i);
}
}
return null;
}
use of org.eclipse.jface.viewers.ViewerRow in project translationstudio8 by heartsome.
the class GridTableViewer method editElement.
/**
* {@inheritDoc}
*/
public void editElement(Object element, int column) {
try {
getControl().setRedraw(false);
Widget item = findItem(element);
if (item != null) {
ViewerRow row = getViewerRowFromItem(item);
if (row != null) {
ViewerCell cell = row.getCell(column);
if (cell != null) {
triggerEditorActivationEvent(new ColumnViewerEditorActivationEvent(cell));
}
}
}
} finally {
getControl().setRedraw(true);
}
// }
}
use of org.eclipse.jface.viewers.ViewerRow in project cubrid-manager by CUBRID.
the class TableFocusHighLighter method hookListener.
private void hookListener(final EditableTableViewer viewer) {
Listener listener = new Listener() {
public void handleEvent(Event event) {
if ((event.detail & SWT.SELECTED) > 0) {
ViewerCell focusCell = getFocusCell();
ViewerRow row = viewer.getViewerRowByItem(event.item);
ViewerCell cell = row.getCell(event.index);
if (focusCell == null || !cell.equals(focusCell)) {
removeSelectionInformation(event, cell);
} else {
markFocusedCell(event, cell);
}
}
}
};
viewer.getControl().addListener(SWT.EraseItem, listener);
}
Aggregations