Example usage for org.eclipse.jface.viewers ViewerRow BELOW

List of usage examples for org.eclipse.jface.viewers ViewerRow BELOW

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers ViewerRow BELOW.

Prototype

int BELOW

To view the source code for org.eclipse.jface.viewers ViewerRow BELOW.

Click Source Link

Document

Constant denoting the row below the current one (value is 2).

Usage

From source file:com.gorillalogic.monkeyconsole.tableview.MonkeyTalkTabularEditor.java

License:Open Source License

private static ViewerCell getNeighbor(ViewerCell currentCell, int directionMask, boolean sameLevel) {
    ViewerRow row;/*from www .j av a 2 s  . c o  m*/

    if ((directionMask & ViewerCell.ABOVE) == ViewerCell.ABOVE) {
        row = currentCell.getViewerRow().getNeighbor(ViewerRow.ABOVE, sameLevel);
    } else if ((directionMask & ViewerCell.BELOW) == ViewerCell.BELOW) {
        row = currentCell.getViewerRow().getNeighbor(ViewerRow.BELOW, sameLevel);
    } else {
        row = currentCell.getViewerRow();
    }

    if (row != null) {
        int columnIndex;
        columnIndex = getVisualIndex(row, currentCell.getColumnIndex());

        int modifier = 0;

        if ((directionMask & ViewerCell.LEFT) == ViewerCell.LEFT) {
            modifier = -1;
        } else if ((directionMask & ViewerCell.RIGHT) == ViewerCell.RIGHT) {
            modifier = 1;
        }

        columnIndex += modifier;

        if (columnIndex >= 0 && columnIndex < row.getColumnCount()) {
            ViewerCell cell = getCellAtVisualIndex(row, columnIndex);
            if (cell != null) {
                while (cell != null && columnIndex < row.getColumnCount() - 1 && columnIndex > 0) {
                    if (isVisible(cell)) {
                        break;
                    }

                    columnIndex += modifier;
                    cell = getCellAtVisualIndex(row, columnIndex);
                    if (cell == null) {
                        break;
                    }
                }
            }

            return cell;
        }
    }
    return null;
}

From source file:edu.ualberta.med.biobank.gui.common.widgets.nebula.tablecombo.TableComboViewerRow.java

License:Open Source License

/**
 * {@inheritDoc}/* www.  j a  va2 s .c  o  m*/
 */
@Override
public ViewerRow getNeighbor(int direction, boolean sameLevel) {
    if (direction == ViewerRow.ABOVE) {
        return getRowAbove();
    } else if (direction == ViewerRow.BELOW) {
        return getRowBelow();
    } else {
        throw new IllegalArgumentException("Illegal value of direction argument."); //$NON-NLS-1$
    }
}

From source file:net.karlmartens.ui.viewer.GridChooserViewerRow.java

License:Apache License

@Override
public ViewerRow getNeighbor(int direction, boolean sameLevel) {
    final GridChooserItem item;
    if (ViewerRow.ABOVE == direction) {
        item = getNeighbor(-1);//w w w.  j  ava2  s.c om
    } else if (ViewerRow.BELOW == direction) {
        item = getNeighbor(1);
    } else {
        throw new IllegalArgumentException();
    }

    if (item == null)
        return null;

    return new GridChooserViewerRow(item);
}

From source file:net.karlmartens.ui.viewer.TableViewerRow.java

License:Apache License

@Override
public ViewerRow getNeighbor(int direction, boolean sameLevel) {
    final TableItem item;
    if (ViewerRow.ABOVE == direction) {
        item = getNeighbor(-1);//w  ww  . j a  v a 2 s .  c  o  m
    } else if (ViewerRow.BELOW == direction) {
        item = getNeighbor(1);
    } else {
        throw new IllegalArgumentException();
    }

    if (item == null)
        return null;

    return new TableViewerRow(item);
}

From source file:org.eclipse.linuxtools.dataviewers.findreplace.STFindReplaceDialog.java

License:Open Source License

/**
 * Returns the position of the specified search string, or <code>-1</code> if the string can
 * not be found when searching using the given options.
 *
 * @param findString the string to search for
 * @param startPosition the position at which to start the search
 * @param forwardSearch the direction of the search
 * @param caseSensitive   should the search be case sensitive
 * @param wrapSearch   should the search wrap to the start/end if arrived at the end/start
 * @param wholeWord does the search string represent a complete word
 * @param regExSearch if <code>true</code> findString represents a regular expression
 * @return the occurrence of the find string following the options or <code>-1</code> if nothing found
 * @since 3.0//from w w w  . j  a  v a2  s.c om
 */
private ViewerCell findIndex(String findString, ViewerCell startPosition, boolean forwardSearch,
        boolean caseSensitive, boolean wrapSearch, boolean wholeWord, boolean regExSearch) {

    if (forwardSearch) {
        if (wrapSearch) {
            ViewerCell index = findAndSelect(startPosition, findString, true, caseSensitive, wholeWord,
                    regExSearch, wrapSearch);
            if (index == null) {
                if (okToUse(getShell()) && !isIncrementalSearch())
                    getShell().getDisplay().beep();

                index = findAndSelect(fTarget.getFirstCell(startPosition, ViewerRow.ABOVE), findString, true,
                        caseSensitive, wholeWord, regExSearch, wrapSearch);
            }
            return index;
        }
        return findAndSelect(startPosition, findString, true, caseSensitive, wholeWord, regExSearch,
                wrapSearch);
    }

    // backward
    if (wrapSearch) {
        ViewerCell index = findAndSelect(startPosition, findString, false, caseSensitive, wholeWord,
                regExSearch, wrapSearch);
        if (index == null) {
            if (okToUse(getShell()) && !isIncrementalSearch())
                getShell().getDisplay().beep();
            index = findAndSelect(fTarget.getFirstCell(startPosition, ViewerRow.BELOW), findString, false,
                    caseSensitive, wholeWord, regExSearch, wrapSearch);
        }
        return index;
    }
    return findAndSelect(startPosition, findString, false, caseSensitive, wholeWord, regExSearch, wrapSearch);
}

From source file:org.eclipse.linuxtools.dataviewers.findreplace.STFindReplaceDialog.java

License:Open Source License

private void calcolateIndex(boolean forwardSearch) {
    if (forwardSearch) {
        if (findReplacePosition.getNeighbor(ViewerCell.RIGHT, true) != null)
            index = findReplacePosition.getNeighbor(ViewerCell.RIGHT, true);
        else {//from   w  ww. ja v a  2s  .  c  o m
            ViewerRow row = findReplacePosition.getViewerRow();
            index = row.getNeighbor(ViewerRow.BELOW, true).getCell(0);
        }
    } else {
        if (findReplacePosition.getNeighbor(ViewerCell.LEFT, true) != null)
            index = findReplacePosition.getNeighbor(ViewerCell.LEFT, true);
        else {
            ViewerRow row = findReplacePosition.getViewerRow();
            index = row.getNeighbor(ViewerRow.ABOVE, true).getCell(0);
        }
    }
}

From source file:org.eclipse.linuxtools.dataviewers.findreplace.STTableFindReplaceTarget.java

License:Open Source License

private ViewerCell findAndSelect(ViewerCell cell, String findString, boolean searchForward, boolean direction,
        boolean caseSensitive, boolean wholeWord, boolean wrapSearch, boolean regExSearch) {

    if (cell == null)
        return null;

    int dirCell = ViewerCell.RIGHT;

    if (!searchForward)
        dirCell = ViewerCell.LEFT;//from w w  w  .j  a va  2 s. co m

    Table table = _viewer.getTable();

    if (!scope || table.isSelected(table.indexOf((TableItem) cell.getItem()))) {
        ViewerCell cellFound = searchInRow(cell.getViewerRow(), cell.getColumnIndex(), findString,
                searchForward, caseSensitive, wholeWord, dirCell, regExSearch);

        if (cellFound != null)
            return cellFound;
    }

    dirCell = ViewerCell.RIGHT;

    int dirRow = 0;
    if (searchForward)
        dirRow = ViewerRow.BELOW;
    else
        dirRow = ViewerRow.ABOVE;

    ViewerRow row = cell.getViewerRow();

    if (table.getSelectionCount() == 0) {
        while (row.getNeighbor(dirRow, true) != null) {
            row = row.getNeighbor(dirRow, true);
            cell = searchInRow(row, 0, findString, searchForward, caseSensitive, wholeWord, dirCell,
                    regExSearch);
            if (cell != null)
                return cell;
        }
    } else {
        while (row.getNeighbor(dirRow, true) != null) {
            row = row.getNeighbor(dirRow, true);
            if (!scope || table.isSelected(table.indexOf((TableItem) row.getItem()))) {
                cell = searchInRow(row, 0, findString, searchForward, caseSensitive, wholeWord, dirCell,
                        regExSearch);
                if (cell != null)
                    return cell;
            }
        }
    }

    return null;

}

From source file:org.eclipse.linuxtools.dataviewers.findreplace.STTableViewerRow.java

License:Open Source License

public ViewerRow getNeighbor(int direction, boolean sameLevel) {
    if (direction == ViewerRow.ABOVE) {
        return getRowAbove();
    } else if (direction == ViewerRow.BELOW) {
        return getRowBelow();
    } else {//from  w  w w.ja  va 2s  .co m
        throw new IllegalArgumentException("Illegal value of direction argument."); //$NON-NLS-1$
    }
}

From source file:org.eclipse.linuxtools.dataviewers.findreplace.STTreeFindReplaceTarget.java

License:Open Source License

private ViewerCell findAndSelect(ViewerCell cell, String findString, boolean searchForward, boolean direction,
        boolean caseSensitive, boolean wholeWord, boolean wrapSearch, boolean regExSearch) {

    if (cell == null)
        return null;

    int dirCell = ViewerCell.RIGHT;

    if (!searchForward)
        dirCell = ViewerCell.LEFT;//ww  w.  j ava  2  s  . c o  m

    if (!scope || fSelections.indexOf(cell.getViewerRow().getItem()) != -1) {
        ViewerCell cellFound = searchInRow(cell.getViewerRow(), cell.getColumnIndex(), findString,
                searchForward, caseSensitive, wholeWord, dirCell, regExSearch);

        if (cellFound != null)
            return cellFound;
    }

    dirCell = ViewerCell.RIGHT;

    int dirRow = 0;
    if (searchForward)
        dirRow = ViewerRow.BELOW;
    else
        dirRow = ViewerRow.ABOVE;

    ViewerRow row = cell.getViewerRow();

    if (fSelections == null) {
        while (row.getNeighbor(dirRow, false) != null) {
            row = row.getNeighbor(dirRow, false);
            cell = searchInRow(row, 0, findString, searchForward, caseSensitive, wholeWord, dirCell,
                    regExSearch);
            if (cell != null)
                return cell;
        }
    } else {
        while (row.getNeighbor(dirRow, false) != null) {
            row = row.getNeighbor(dirRow, false);
            if (!scope || fSelections.indexOf(cell.getViewerRow().getItem()) != -1) {
                cell = searchInRow(row, 0, findString, searchForward, caseSensitive, wholeWord, dirCell,
                        regExSearch);
                if (cell != null)
                    return cell;
            }
        }
    }

    return null;

}

From source file:org.eclipse.linuxtools.dataviewers.findreplace.STTreeViewerRow.java

License:Open Source License

public ViewerRow getNeighbor(int direction, boolean sameLevel) {
    if (direction == ViewerRow.ABOVE) {
        return getRowAbove(sameLevel);
    } else if (direction == ViewerRow.BELOW) {
        return getRowBelow(sameLevel);
    } else {/*from   w  ww  .jav  a  2  s . c  om*/
        throw new IllegalArgumentException("Illegal value of direction argument."); //$NON-NLS-1$
    }
}