本文整理了Java中org.eclipse.swt.widgets.List.indexOf()
方法的一些代码示例,展示了List.indexOf()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。List.indexOf()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.List
类名称:List
方法名:indexOf
[英]Gets the index of an item.
The list is searched starting at 0 until an item is found that is equal to the search item. If no item is found, -1 is returned. Indexing is zero based.
[中]获取项的索引。
从0开始搜索列表,直到找到与搜索项相等的项。如果未找到任何项,则返回-1。索引是基于零的。
代码示例来源:origin: pentaho/pentaho-kettle
private void delete() {
String[] result = wResult.getSelection();
for ( int i = result.length - 1; i >= 0; i-- ) {
int idx = wResult.indexOf( result[i] );
if ( idx >= 0 && idx < mappings.size() ) {
mappings.remove( idx );
}
}
refreshMappings();
}
代码示例来源:origin: pentaho/pentaho-kettle
int index = wTodo.indexOf( key );
if ( index >= 0 ) {
lastFoundKey = key;
代码示例来源:origin: pentaho/pentaho-kettle
/**
* Copy information from the meta-data input to the dialog fields.
*/
public void getData() {
// Populate the list of validations...
//
refreshValidationsList();
enableFields();
wValidateAll.setSelection( input.isValidatingAll() );
wConcatErrors.setSelection( input.isConcatenatingErrors() );
wConcatSeparator.setText( Const.NVL( input.getConcatenationSeparator(), "" ) );
// Select the first available field...
//
if ( input.getValidations().size() > 0 ) {
Validation validatorField = input.getValidations().get( 0 );
String description = validatorField.getName();
int index = wValidationsList.indexOf( description );
if ( index >= 0 ) {
wValidationsList.select( index );
showSelectedValidatorField( description );
}
}
setFlags();
wStepname.selectAll();
wStepname.setFocus();
}
代码示例来源:origin: pentaho/pentaho-kettle
int idx = wDBType.indexOf( wDBIDtoNameMap.get( databaseMeta.getPluginId() ) );
if ( idx >= 0 ) {
wDBType.select( idx );
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
/**
* Gets the index of an item.
* <p>
* The list is searched starting at 0 until an
* item is found that is equal to the search item.
* If no item is found, -1 is returned. Indexing
* is zero based.
*
* @param string the search item
* @return the index of the item
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the string is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int indexOf (String string) {
return indexOf (string, 0);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
/**
* Gets the index of an item.
* <p>
* The list is searched starting at 0 until an
* item is found that is equal to the search item.
* If no item is found, -1 is returned. Indexing
* is zero based.
*
* @param string the search item
* @return the index of the item
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the string is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int indexOf (String string) {
checkWidget();
return indexOf (string, 0);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
/**
* Gets the index of an item.
* <p>
* The list is searched starting at 0 until an
* item is found that is equal to the search item.
* If no item is found, -1 is returned. Indexing
* is zero based.
*
* @param string the search item
* @return the index of the item
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the string is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int indexOf (String string) {
checkWidget();
return indexOf (string, 0);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
/**
* Searches the receiver's list starting at the first item
* (index 0) until an item is found that is equal to the
* argument, and returns the index of that item. If no item
* is found, returns -1.
*
* @param string the search item
* @return the index of the item
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the string is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int indexOf (String string) {
checkWidget ();
if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
return list.indexOf (string);
}
/**
代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui
/**
* Searches the receiver's list starting at the first item
* (index 0) until an item is found that is equal to the
* argument, and returns the index of that item. If no item
* is found, returns -1.
*
* @param string the search item
* @return the index of the item
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the string is null</li>
* </ul>
* @exception org.eclipse.swt.SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int indexOf (String string) {
checkWidget ();
if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
return list.indexOf (string);
}
/**
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
/**
* Searches the receiver's list starting at the first item
* (index 0) until an item is found that is equal to the
* argument, and returns the index of that item. If no item
* is found, returns -1.
*
* @param string the search item
* @return the index of the item
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the string is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int indexOf (String string) {
checkWidget ();
if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
return list.indexOf (string);
}
/**
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
/**
* Searches the receiver's list starting at the first item
* (index 0) until an item is found that is equal to the
* argument, and returns the index of that item. If no item
* is found, returns -1.
*
* @param string the search item
* @return the index of the item
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the string is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int indexOf (String string) {
checkWidget ();
if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
return list.indexOf (string);
}
/**
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
/**
* Searches the receiver's list starting at the first item
* (index 0) until an item is found that is equal to the
* argument, and returns the index of that item. If no item
* is found, returns -1.
*
* @param string the search item
* @return the index of the item
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the string is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int indexOf (String string) {
checkWidget ();
if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
return list.indexOf (string);
}
/**
代码示例来源:origin: net.sf.okapi.steps/okapi-step-tokenization-ui
@Override
protected void actionAdd(int afterIndex) {
String[] res = TokenSelector.select(getShell(), TokenSelectorPePage.class, "WORD,NUMBER");
for (int i = 0; i < res.length; i++) {
if (list.indexOf(res[i]) == -1)
list.add(res[i]);
}
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
/**
* Searches the receiver's list starting at the given,
* zero-relative index until an item is found that is equal
* to the argument, and returns the index of that item. If
* no item is found or the starting index is out of range,
* returns -1.
*
* @param string the search item
* @param start the zero-relative index at which to begin the search
* @return the index of the item
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the string is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int indexOf (String string, int start) {
checkWidget ();
if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT);
return list.indexOf (string, start);
}
代码示例来源:origin: net.sf.okapi.steps/okapi-step-tokenization-ui
@Override
protected void actionAdd(int afterIndex) {
String[] res = LanguageSelector.select(getShell(), LanguageSelectorPePage.class, "EN-US,RU-RU");
for (int i = 0; i < res.length; i++) {
if (list.indexOf(res[i]) == -1)
list.add(res[i]);
}
}
代码示例来源:origin: net.sf.okapi.lib/okapi-lib-segmentation-ui
private void updateLanguageRules (String selection) {
lbLangRules.removeAll();
LinkedHashMap<String, ArrayList<Rule>> list = srxDoc.getAllLanguageRules();
if (( selection != null ) && !list.containsKey(selection) ) {
selection = null;
}
for ( String ruleName : list.keySet() ) {
lbLangRules.add(ruleName);
if ( selection == null ) selection = ruleName;
}
if ( lbLangRules.getItemCount() > 0 ) {
if ( selection != null ) {
lbLangRules.select(lbLangRules.indexOf(selection));
}
}
updateRulesButtons();
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc
/**
* Searches the receiver's list starting at the first item
* until an item is found that is equal to the argument,
* and removes that item from the list.
*
* @param string the item to remove
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the string is null</li>
* <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void remove (String string) {
checkWidget();
if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
int index = indexOf (string, 0);
if (index == -1) error (SWT.ERROR_INVALID_ARGUMENT);
remove (index);
}
代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64
/**
* Searches the receiver's list starting at the first item
* until an item is found that is equal to the argument,
* and removes that item from the list.
*
* @param string the item to remove
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the string is null</li>
* <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void remove (String string) {
checkWidget();
if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
int index = indexOf (string, 0);
if (index == -1) error (SWT.ERROR_INVALID_ARGUMENT);
remove (index);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x
/**
* Searches the receiver's list starting at the first item
* until an item is found that is equal to the argument,
* and removes that item from the list.
*
* @param string the item to remove
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the string is null</li>
* <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void remove (String string) {
checkWidget();
if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
int index = indexOf (string, 0);
if (index == -1) error (SWT.ERROR_INVALID_ARGUMENT);
remove (index);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc
/**
* Searches the receiver's list starting at the first item
* until an item is found that is equal to the argument,
* and removes that item from the list.
*
* @param string the item to remove
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the string is null</li>
* <li>ERROR_INVALID_ARGUMENT - if the string is not found in the list</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void remove (String string) {
checkWidget();
if (string == null) error (SWT.ERROR_NULL_ARGUMENT);
int index = indexOf (string, 0);
if (index == -1) error (SWT.ERROR_INVALID_ARGUMENT);
remove (index);
}
内容来源于网络,如有侵权,请联系作者删除!