org.eclipse.swt.widgets.Table.getSelectionIndices()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(200)

本文整理了Java中org.eclipse.swt.widgets.Table.getSelectionIndices()方法的一些代码示例,展示了Table.getSelectionIndices()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.getSelectionIndices()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Table
类名称:Table
方法名:getSelectionIndices

Table.getSelectionIndices介绍

[英]Returns the zero-relative indices of the items which are currently selected in the receiver. The order of the indices is unspecified. The array is empty if no items are selected.

Note: This is not the actual structure used by the receiver to maintain its selection, so modifying the array will not affect the receiver.
[中]返回接收器中当前选定项的零相对索引。索引的顺序尚未确定。如果未选择任何项目,则数组为空。
注意:这不是接收器用于保持其选择的实际结构,因此修改阵列不会影响接收器。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

  1. public int[] getSelectionIndices() {
  2. return table.getSelectionIndices();
  3. }

代码示例来源:origin: pentaho/pentaho-kettle

  1. private String getSQL() {
  2. StringBuilder sql = new StringBuilder();
  3. int[] idx = wFields.table.getSelectionIndices();

代码示例来源:origin: pentaho/pentaho-kettle

  1. public void removeRule() {
  2. MessageBox box =
  3. new MessageBox( shell, SWT.ICON_WARNING | SWT.APPLICATION_MODAL | SWT.SHEET | SWT.YES | SWT.NO );
  4. box.setText( "Warning" );
  5. box.setMessage( "Are you sure you want to remove the selected rules from the list?" );
  6. int answer = box.open();
  7. if ( answer != SWT.YES ) {
  8. return;
  9. }
  10. int[] indices = table.getSelectionIndices();
  11. Arrays.sort( indices );
  12. for ( int i = indices.length - 1; i >= 0; i-- ) {
  13. importRules.getRules().remove( indices[i] );
  14. }
  15. // Refresh the whole list..
  16. //
  17. getCompositesData();
  18. }

代码示例来源:origin: pentaho/pentaho-kettle

  1. private void moveRows( int offset ) {
  2. if ( ( offset != 1 ) && ( offset != -1 ) ) {
  3. return;
  4. }
  5. int[] selectionIndicies = table.getSelectionIndices();
  6. int selectedIndex = table.getSelectionIndex();
  7. // selectionIndicies is not guaranteed to be in any order so must sort
  8. // before using
  9. Arrays.sort( selectionIndicies );
  10. if ( offset == 1 ) {
  11. if ( selectionIndicies[selectionIndicies.length - 1] >= table.getItemCount() - 1 ) {
  12. // If the last row in the table is selected then don't move any rows
  13. // down
  14. return;
  15. }
  16. selectionIndicies = moveRowsDown( selectionIndicies );
  17. } else {
  18. if ( selectionIndicies[0] == 0 ) {
  19. // If the first row in the table is selected then don't move any rows up
  20. return;
  21. }
  22. selectionIndicies = moveRowsUp( selectionIndicies );
  23. }
  24. activeTableRow = selectedIndex + offset;
  25. table.setSelection( activeTableRow );
  26. table.setSelection( selectionIndicies );
  27. activeTableItem = table.getItem( activeTableRow );
  28. }

代码示例来源:origin: pentaho/pentaho-kettle

  1. private void exec() {
  2. int[] idx = wFields.table.getSelectionIndices();

代码示例来源:origin: pentaho/pentaho-kettle

  1. int[] selectionIndices = wSteps.table.getSelectionIndices();
  2. if ( selectionIndices == null || selectionIndices.length != 1 ) {
  3. return;

代码示例来源:origin: pentaho/pentaho-kettle

  1. private void keepSelected() {
  2. int[] sels = table.getSelectionIndices();

代码示例来源:origin: pentaho/pentaho-kettle

  1. int[] items = table.getSelectionIndices();

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

  1. private boolean needsSelectionChange(Object oldElement, Object newElement) {
  2. int[] selected= fTable.getSelectionIndices();
  3. if (selected.length != 1)
  4. return true;
  5. if (selected[0] != 0)
  6. return true;
  7. if (oldElement == null)
  8. return true;
  9. return !oldElement.equals(newElement);
  10. }

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

  1. private boolean needsSelectionChange(Object oldElement, Object newElement) {
  2. int[] selected= fTable.getSelectionIndices();
  3. if (selected.length != 1)
  4. return true;
  5. if (selected[0] != 0)
  6. return true;
  7. if (oldElement == null)
  8. return true;
  9. return !oldElement.equals(newElement);
  10. }

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

  1. private boolean canMoveDown() {
  2. int[] indc= fTableViewer.getTable().getSelectionIndices();
  3. int k= fAllWorkingSets.size() - 1;
  4. for (int i= indc.length - 1; i >= 0; i--, k--) {
  5. if (indc[i] != k) {
  6. return true;
  7. }
  8. }
  9. return false;
  10. }

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

  1. private boolean canMoveUp() {
  2. if (!fIsSortingEnabled) {
  3. int[] indc= fTableViewer.getTable().getSelectionIndices();
  4. for (int i= 0; i < indc.length; i++) {
  5. if (indc[i] != i) {
  6. return true;
  7. }
  8. }
  9. }
  10. return false;
  11. }

代码示例来源:origin: oyse/yedit

  1. protected boolean canMoveDown() {
  2. if (isOkToUse(fTableControl)) {
  3. int[] indc= fTable.getTable().getSelectionIndices();
  4. int k= fElements.size() - 1;
  5. for (int i= indc.length - 1; i >= 0 ; i--, k--) {
  6. if (indc[i] != k) {
  7. return true;
  8. }
  9. }
  10. }
  11. return false;
  12. }

代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui

  1. public boolean canMoveDown() {
  2. if (isOkToUse(fTableControl)) {
  3. int[] indc= fTable.getTable().getSelectionIndices();
  4. int k= fElements.size() - 1;
  5. for (int i= indc.length - 1; i >= 0 ; i--, k--) {
  6. if (indc[i] != k) {
  7. return true;
  8. }
  9. }
  10. }
  11. return false;
  12. }

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

  1. public boolean canMoveUp() {
  2. if (isOkToUse(fTableControl)) {
  3. int[] indc= fTable.getTable().getSelectionIndices();
  4. for (int i= 0; i < indc.length; i++) {
  5. if (indc[i] != i) {
  6. return true;
  7. }
  8. }
  9. }
  10. return false;
  11. }

代码示例来源:origin: org.eclipse.xtext/ui

  1. public boolean canMoveUp() {
  2. if (isOkToUse(fTableControl)) {
  3. int[] indc = fTable.getTable().getSelectionIndices();
  4. for (int i = 0; i < indc.length; i++) {
  5. if (indc[i] != i) {
  6. return true;
  7. }
  8. }
  9. }
  10. return false;
  11. }

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

  1. public boolean canMoveUp() {
  2. if (isOkToUse(fTableControl)) {
  3. int[] indc= fTable.getTable().getSelectionIndices();
  4. for (int i= 0; i < indc.length; i++) {
  5. if (indc[i] != i) {
  6. return true;
  7. }
  8. }
  9. }
  10. return false;
  11. }

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.m2e.core.ui

  1. public void widgetSelected(SelectionEvent e) {
  2. propertiesTable.remove(propertiesTable.getSelectionIndices());
  3. removeButton.setEnabled(propertiesTable.getSelectionCount() > 0);
  4. validate();
  5. }
  6. });

代码示例来源:origin: org.eclipse/org.eclipse.jst.j2ee.ui

  1. protected void updateButtonEnablements() {
  2. int[] indices = availableJARsViewer.getTable().getSelectionIndices();
  3. if (upButton != null && downButton != null) {
  4. upButton.setEnabled(canMoveUp(indices));
  5. downButton.setEnabled(canMoveDown(indices, availableJARsViewer.getTable().getItemCount()));
  6. }
  7. }

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

  1. private void handleAdd() {
  2. IStructuredSelection ssel = fAvailableListViewer.getStructuredSelection();
  3. if (!ssel.isEmpty()) {
  4. Table table = fAvailableListViewer.getTable();
  5. int index = table.getSelectionIndices()[0];
  6. doAdd(ssel.toList());
  7. table.setSelection(index < table.getItemCount() ? index : table.getItemCount() - 1);
  8. pageChanged(true, false);
  9. }
  10. }

相关文章

Table类方法