724 * Selects the item at the given index (if not -1))
725 *
726 * @param index
727 * the index of the item
728 * @return {@code true} if selected index is the same as the provided. {@code false} otherwise
729 */
730 public boolean select(int index) {
731 return select(index, 0);
732 }
733
734 /**
735 * Selects the table row at a specified "start" index, and uses SHIFT+DOWN to
736 * add to the selection up until a specified "end" index
737 *
738 * @param from
739 * the row index to start from
740 * @param to
741 * the row index to stop selecting
742 */
743 public void selectItems(int start, int end) {
744 select(start);
745 for (int i = 0; i < end; i++) {
746 getShell().keyboard().pushKey(KeyboardButtons.DOWN, new KeyboardModifiers[] {KeyboardModifiers.SHIFT_DOWN_MASK});
747 }
748 }
749
750 /**
751 * Context clicks the currently selected table item and chooses the supplied option
752 *
753 * @param desiredState
754 * the selection state to which the context choice is to be to set to
755 * @param choice
756 * the context menu path to the option
757 */
758 @SuppressWarnings("unchecked")
759 public void contextChoose(boolean desiredState, String ... choice) {
760 scrollbarSafeSelection();
761 StringPopupSelectableOwner<Table> spo = control.as(StringPopupSelectableOwner.class);
762 spo.setPolicy(policy);
763 spo.push(desiredState, getRelativeClickPoint(getSelectedItem()), choice);
|
724 * Selects the item at the given index (if not -1))
725 *
726 * @param index
727 * the index of the item
728 * @return {@code true} if selected index is the same as the provided. {@code false} otherwise
729 */
730 public boolean select(int index) {
731 return select(index, 0);
732 }
733
734 /**
735 * Selects the table row at a specified "start" index, and uses SHIFT+DOWN to
736 * add to the selection up until a specified "end" index
737 *
738 * @param from
739 * the row index to start from
740 * @param to
741 * the row index to stop selecting
742 */
743 public void selectItems(int start, int end) {
744 focusMc();
745 select(start);
746 for (int i = 0; i < end; i++) {
747 getShell().keyboard().pushKey(KeyboardButtons.DOWN, new KeyboardModifiers[] {KeyboardModifiers.SHIFT_DOWN_MASK});
748 }
749 }
750
751 /**
752 * Context clicks the currently selected table item and chooses the supplied option
753 *
754 * @param desiredState
755 * the selection state to which the context choice is to be to set to
756 * @param choice
757 * the context menu path to the option
758 */
759 @SuppressWarnings("unchecked")
760 public void contextChoose(boolean desiredState, String ... choice) {
761 scrollbarSafeSelection();
762 StringPopupSelectableOwner<Table> spo = control.as(StringPopupSelectableOwner.class);
763 spo.setPolicy(policy);
764 spo.push(desiredState, getRelativeClickPoint(getSelectedItem()), choice);
|