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

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

本文整理了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

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

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

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

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

public void removeRule() {
 MessageBox box =
  new MessageBox( shell, SWT.ICON_WARNING | SWT.APPLICATION_MODAL | SWT.SHEET | SWT.YES | SWT.NO );
 box.setText( "Warning" );
 box.setMessage( "Are you sure you want to remove the selected rules from the list?" );
 int answer = box.open();
 if ( answer != SWT.YES ) {
  return;
 }
 int[] indices = table.getSelectionIndices();
 Arrays.sort( indices );
 for ( int i = indices.length - 1; i >= 0; i-- ) {
  importRules.getRules().remove( indices[i] );
 }
 // Refresh the whole list..
 //
 getCompositesData();
}

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

private void moveRows( int offset ) {
 if ( ( offset != 1 ) && ( offset != -1 ) ) {
  return;
 }
 int[] selectionIndicies = table.getSelectionIndices();
 int selectedIndex = table.getSelectionIndex();
 // selectionIndicies is not guaranteed to be in any order so must sort
 // before using
 Arrays.sort( selectionIndicies );
 if ( offset == 1 ) {
  if ( selectionIndicies[selectionIndicies.length - 1] >= table.getItemCount() - 1 ) {
   // If the last row in the table is selected then don't move any rows
   // down
   return;
  }
  selectionIndicies = moveRowsDown( selectionIndicies );
 } else {
  if ( selectionIndicies[0] == 0 ) {
   // If the first row in the table is selected then don't move any rows up
   return;
  }
  selectionIndicies = moveRowsUp( selectionIndicies );
 }
 activeTableRow = selectedIndex + offset;
 table.setSelection( activeTableRow );
 table.setSelection( selectionIndicies );
 activeTableItem = table.getItem( activeTableRow );
}

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

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

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

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

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

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

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

int[] items = table.getSelectionIndices();

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

private boolean needsSelectionChange(Object oldElement, Object newElement) {
  int[] selected= fTable.getSelectionIndices();
  if (selected.length != 1)
    return true;
  if (selected[0] != 0)
    return true;
  if (oldElement == null)
    return true;
  return !oldElement.equals(newElement);
}

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

private boolean needsSelectionChange(Object oldElement, Object newElement) {
  int[] selected= fTable.getSelectionIndices();
  if (selected.length != 1)
    return true;
  if (selected[0] != 0)
    return true;
  if (oldElement == null)
    return true;
  return !oldElement.equals(newElement);
}

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

private boolean canMoveDown() {
  int[] indc= fTableViewer.getTable().getSelectionIndices();
  int k= fAllWorkingSets.size() - 1;
  for (int i= indc.length - 1; i >= 0; i--, k--) {
    if (indc[i] != k) {
      return true;
    }
  }
  return false;
}

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

private boolean canMoveUp() {
  if (!fIsSortingEnabled) {
    int[] indc= fTableViewer.getTable().getSelectionIndices();
    for (int i= 0; i < indc.length; i++) {
      if (indc[i] != i) {
        return true;
      }
    }
  }
  return false;
}

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

protected boolean canMoveDown() {
  if (isOkToUse(fTableControl)) {
    int[] indc= fTable.getTable().getSelectionIndices();
    int k= fElements.size() - 1;
    for (int i= indc.length - 1; i >= 0 ; i--, k--) {
      if (indc[i] != k) {
        return true;
      }
    }
  }
  return false;
}

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

public boolean canMoveDown() {
  if (isOkToUse(fTableControl)) {
    int[] indc= fTable.getTable().getSelectionIndices();
    int k= fElements.size() - 1;
    for (int i= indc.length - 1; i >= 0 ; i--, k--) {
      if (indc[i] != k) {
        return true;
      }
    }
  }
  return false;
}

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

public boolean canMoveUp() {
  if (isOkToUse(fTableControl)) {
    int[] indc= fTable.getTable().getSelectionIndices();
    for (int i= 0; i < indc.length; i++) {
      if (indc[i] != i) {
        return true;
      }
    }
  }
  return false;
}

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

public boolean canMoveUp() {
  if (isOkToUse(fTableControl)) {
    int[] indc = fTable.getTable().getSelectionIndices();
    for (int i = 0; i < indc.length; i++) {
      if (indc[i] != i) {
        return true;
      }
    }
  }
  return false;
}

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

public boolean canMoveUp() {
  if (isOkToUse(fTableControl)) {
    int[] indc= fTable.getTable().getSelectionIndices();
    for (int i= 0; i < indc.length; i++) {
      if (indc[i] != i) {
        return true;
      }
    }
  }
  return false;
}

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

public void widgetSelected(SelectionEvent e) {
  propertiesTable.remove(propertiesTable.getSelectionIndices());
  removeButton.setEnabled(propertiesTable.getSelectionCount() > 0);
  validate();
 }
});

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

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

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

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

相关文章

微信公众号

最新文章

更多

Table类方法