Search in sources :

Example 1 with ISelectionEvent

use of net.sourceforge.nattable.selection.event.ISelectionEvent in project translationstudio8 by heartsome.

the class RowSelectionProvider method handleLayerEvent.

public void handleLayerEvent(ILayerEvent event) {
    if (event instanceof ISelectionEvent) {
        int[] rowPositions = selectionLayer.getFullySelectedRowPositions();
        if (fullySelectedRowsOnly && rowPositions.length == 0) {
            ActiveCellRegion.setActiveCellRegion(null);
            return;
        }
        Arrays.sort(rowPositions);
        int rowPosition = rowPositions[rowPositions.length - 1];
        if (rowPosition == currentRowPosition) {
            return;
        }
        currentRowPosition = rowPosition;
        int rowIndex = selectionLayer.getRowIndexByPosition(rowPosition);
        ISelection selection = new StructuredSelection(rowIndex);
        SelectionChangedEvent e = new SelectionChangedEvent(this, selection);
        for (ISelectionChangedListener listener : listeners) {
            listener.selectionChanged(e);
        }
    }
}
Also used : ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) ISelection(org.eclipse.jface.viewers.ISelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) ISelectionEvent(net.sourceforge.nattable.selection.event.ISelectionEvent)

Aggregations

ISelectionEvent (net.sourceforge.nattable.selection.event.ISelectionEvent)1 ISelection (org.eclipse.jface.viewers.ISelection)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1