本文整理了Java中org.eclipse.swt.widgets.Table.getSelectionIndex()
方法的一些代码示例,展示了Table.getSelectionIndex()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.getSelectionIndex()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Table
类名称:Table
方法名:getSelectionIndex
[英]Returns the zero-relative index of the item which is currently selected in the receiver, or -1 if no item is selected.
[中]返回接收器中当前选定项的零相对索引,如果未选定项,则返回-1。
代码示例来源:origin: pentaho/pentaho-kettle
public int getSelectionIndex() {
return table.getSelectionIndex();
}
代码示例来源:origin: caoxinyu/RedisClient
protected void tableItemSelected() {
TableItem[] items = table.getSelection();
if (items.length == 1) {
btnDelete.setEnabled(true);
if (table.getSelectionIndex() != 0)
btnUp.setEnabled(true);
else
btnUp.setEnabled(false);
if (table.getSelectionIndex() != table.getItemCount() - 1)
btnDown.setEnabled(true);
else
btnDown.setEnabled(false);
} else if (items.length > 1) {
btnDelete.setEnabled(true);
btnUp.setEnabled(false);
btnDown.setEnabled(false);
} else {
btnDelete.setEnabled(false);
btnUp.setEnabled(false);
btnDown.setEnabled(false);
}
}
代码示例来源:origin: pentaho/pentaho-kettle
private void edit() {
int idx = wFields.table.getSelectionIndex();
if ( idx >= 0 ) {
stepname = wFields.table.getItem( idx ).getText( 1 );
dispose();
}
}
代码示例来源:origin: pentaho/pentaho-kettle
int nr = model.logDisplayTableView.table.getSelectionIndex();
if ( nr >= 0 && nr < list.size() ) {
代码示例来源:origin: pentaho/pentaho-kettle
int nr = model.logDisplayTableView.table.getSelectionIndex();
if ( nr >= 0 && nr < list.size() ) {
代码示例来源:origin: caoxinyu/RedisClient
@Override
public void widgetSelected(SelectionEvent e) {
TableItem[] items = table.getSelection();
service.setValue(id, db, key, table.getSelectionIndex(), items[0].getText());
table.setSelection(-1);
currentData.setItem(null);
status = Status.Normal;
statusChanged();
}
});
代码示例来源: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 edit() {
int idx = wFields.table.getSelectionIndex();
if ( idx >= 0 ) {
stepname = wFields.table.getItem( idx ).getText( 1 );
dispose();
} else {
stepname = null;
MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
mb.setText( BaseMessages.getString( PKG, "StepFieldsDialog.OriginStep.Title" ) );
mb.setMessage( BaseMessages.getString( PKG, "StepFieldsDialog.OriginStep.Message" ) );
mb.open();
}
}
代码示例来源:origin: pentaho/pentaho-kettle
private void edit() {
int idx = wFields.table.getSelectionIndex();
if ( idx >= 0 ) {
stepname = wFields.table.getItem( idx ).getText( 5 );
dispose();
} else {
stepname = null;
MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
mb.setText( BaseMessages.getString( PKG, "StepFieldsDialog.OriginStep.Title" ) );
mb.setMessage( BaseMessages.getString( PKG, "StepFieldsDialog.OriginStep.Message" ) );
mb.open();
}
}
代码示例来源:origin: caoxinyu/RedisClient
@Override
public void widgetSelected(SelectionEvent e) {
TableItem[] items = table.getItems();
TableItem[] selectedItems = table.getSelection();
String selectedText = selectedItems[0].getText();
int selected = table.getSelectionIndex();
String upText = items[selected - 1].getText();
items[selected].setText(upText);
items[selected - 1].setText(selectedText);
table.setSelection(selected - 1);
if (selected == 1)
tableItemSelected();
}
});
代码示例来源:origin: caoxinyu/RedisClient
@Override
public void widgetSelected(SelectionEvent e) {
TableItem[] items = table.getItems();
TableItem[] selectedItems = table.getSelection();
String selectedText = selectedItems[0].getText();
int selected = table.getSelectionIndex();
String downText = items[selected + 1].getText();
items[selected].setText(downText);
items[selected + 1].setText(selectedText);
table.setSelection(selected + 1);
if (selected == table.getItemCount() - 2)
tableItemSelected();
}
});
代码示例来源:origin: org.eclipse/org.eclipse.wst.server.ui
public void widgetSelected(SelectionEvent event) {
int index = table.getSelectionIndex();
if (index == 0)
server = null;
else if (index > 0)
server = servers[index-1];
}
});
代码示例来源:origin: BiglySoftware/BiglyBT
@Override
public void handleEvent(Event arg0) {
action.setEnabled(subscriptionsList.getSelectionIndex() != -1);
}
});
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface.text
@Override
public void keyReleased(KeyEvent e) {
if (!Helper.okToUse(fProposalShell))
return;
if (e.character == 0 && e.keyCode == SWT.CTRL) {
// http://dev.eclipse.org/bugs/show_bug.cgi?id=34754
int index= fProposalTable.getSelectionIndex();
if (index >= 0)
selectProposal(index, false);
}
}
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.ws.consumption.ui
public void widgetSelected(SelectionEvent evt)
{
Table table = (Table) (evt.widget);
selectedBeanIndex = new Integer(table.getSelectionIndex());
statusListener_.handleEvent(null);
}
});
代码示例来源:origin: org.apache.directory.studio/apacheds.configuration
public void mouseDoubleClick( MouseEvent e )
{
if ( interceptorsTable.getSelectionIndex() != -1 )
{
okPressed();
}
}
} );
代码示例来源:origin: org.apache.directory.studio/apacheds.configuration
public void mouseDoubleClick( MouseEvent e )
{
if ( interceptorsTable.getSelectionIndex() != -1 )
{
okPressed();
}
}
} );
代码示例来源:origin: org.apache.directory.studio/apacheds.configuration
public void mouseDoubleClick( MouseEvent e )
{
if ( extendedOperationsTable.getSelectionIndex() != -1 )
{
okPressed();
}
}
} );
代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui
private void handleDown() {
Table table = getTablePart().getTableViewer().getTable();
int index = table.getSelectionIndex();
if (index != table.getItemCount() - 1)
swap(index, index + 1);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.search
void updateStatusLine() {
boolean hasSingleSelection= getSelectedEntriesCount() == 1;
String location= ""; //$NON-NLS-1$
if (hasSingleSelection) {
ISearchResultViewEntry entry= (ISearchResultViewEntry)getTable().getItem(getTable().getSelectionIndex()).getData();
IPath path= entry.getResource().getFullPath();
if (path != null)
location= path.makeRelative().toString();
}
setStatusLineMessage(location);
}
内容来源于网络,如有侵权,请联系作者删除!