本文整理了Java中org.eclipse.swt.widgets.List.getSelectionIndex()
方法的一些代码示例,展示了List.getSelectionIndex()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。List.getSelectionIndex()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.List
类名称:List
方法名: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 void widgetSelected( SelectionEvent arg0 ) {
showLogTypeOptions( wLogTypeList.getSelectionIndex() );
}
} );
代码示例来源:origin: pentaho/pentaho-kettle
public void widgetSelected( SelectionEvent arg0 ) {
showLogTypeOptions( wLogTypeList.getSelectionIndex() );
}
} );
代码示例来源:origin: pentaho/pentaho-kettle
@Override public void widgetSelected( SelectionEvent selectionEvent ) {
updateFields( definitions.get( wInputList.getSelectionIndex() ), input, wMainPath, wlInputStep, wInputStep,
wbInputStep, wlOutputStep, wOutputStep, wbOutputStep, wlDescription, wDescription, wFieldMappings,
wRenameOutput );
}
} );
代码示例来源:origin: pentaho/pentaho-kettle
@Override
public void focusLost( FocusEvent event ) {
definitions.get( wInputList.getSelectionIndex() ).setInputStepname( wInputStep.getText() );
String label = !Utils.isEmpty( wInputStep.getText() ) ? wInputStep.getText()
: tabTitle + ( wInputList.getSelectionIndex() > 0 ? String.valueOf( wInputList.getSelectionIndex() + 1 )
: "" );
wInputList.setItem( wInputList.getSelectionIndex(), label );
}
} );
代码示例来源:origin: pentaho/pentaho-kettle
@Override
public void widgetSelected( SelectionEvent event ) {
definitions.get( wInputList.getSelectionIndex() )
.setMainDataPath( !definitions.get( wInputList.getSelectionIndex() ).isMainDataPath() );
}
代码示例来源:origin: pentaho/pentaho-kettle
@Override
public void widgetSelected( SelectionEvent event ) {
definitions.get( wInputList.getSelectionIndex() ).setRenamingOnOutput( !definitions.get( wInputList.getSelectionIndex() ).isRenamingOnOutput() );
}
} );
代码示例来源:origin: pentaho/pentaho-kettle
@Override
public void focusLost( FocusEvent event ) {
definitions.get( wInputList.getSelectionIndex() ).setDescription( wDescription.getText() );
}
} );
代码示例来源:origin: pentaho/pentaho-kettle
@Override
public void widgetSelected( SelectionEvent event ) {
String stepName = selectTransformationStepname( input, input );
if ( stepName != null ) {
wInputStep.setText( stepName );
definitions.get( wInputList.getSelectionIndex() ).setInputStepname( stepName );
}
}
} );
代码示例来源:origin: pentaho/pentaho-kettle
public void widgetSelected( SelectionEvent e ) {
// Clear the validation rules for a certain field...
//
int index = wValidationsList.getSelectionIndex();
if ( index >= 0 ) {
selectionList.remove( index );
selectedField = null;
wValidationsList.remove( index );
enableFields();
if ( selectionList.size() > 0 ) {
wValidationsList.select( selectionList.size() - 1 );
}
}
}
} );
代码示例来源:origin: pentaho/pentaho-kettle
@Override
public void widgetSelected( SelectionEvent event ) {
String stepName = selectTransformationStepname( !input, input );
if ( stepName != null ) {
wOutputStep.setText( stepName );
definitions.get( wInputList.getSelectionIndex() ).setOutputStepname( stepName );
try {
enableMappingButton( wbEnterMapping, input, wInputStep.getText(), wOutputStep.getText() );
} catch ( KettleException e ) {
// Show the missing/wrong stepname error
new ErrorDialog( shell, "Error", "Unexpected error", e );
}
}
}
} );
代码示例来源:origin: pentaho/pentaho-kettle
private void ok() {
if ( Utils.isEmpty( wStepname.getText() ) ) {
return;
}
stepname = wStepname.getText(); // return value
input.setFilenameField( wFilenameField.getText() );
if ( wTypes.getSelectionIndex() >= 0 ) {
input.setFileType( wTypes.getSelectionIndex() );
} else {
input.setFileType( ResultFile.FILE_TYPE_GENERAL );
}
dispose();
}
}
代码示例来源:origin: pentaho/pentaho-kettle
void refreshObject() {
int index = list.getSelectionIndex();
if ( index == -1 ) {
return;
}
if ( check.getSelection() ) {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
PrintStream s = new PrintStream( stream );
errors[index].printStackTrace( s );
text.setText( stream.toString() );
text.setVisible( true );
canvas.setVisible( false );
} else {
canvas.setVisible( true );
text.setVisible( false );
canvas.redraw();
}
}
代码示例来源:origin: pentaho/pentaho-kettle
private boolean findSource() {
// Guess, user selects an entry in the list on the right.
// Find a comparable entry in the source list...
boolean found = false;
int targetIndex = wTarget.getSelectionIndex();
// Skip everything after the bracket...
String targetString = wTarget.getItem( targetIndex ).toUpperCase();
int length = targetString.length();
boolean first = true;
while ( !found && ( length >= 2 || first ) ) {
first = false;
for ( int i = 0; i < wSource.getItemCount() && !found; i++ ) {
if ( wSource.getItem( i ).toUpperCase().indexOf( targetString.substring( 0, length ) ) >= 0 ) {
wSource.setSelection( i );
found = true;
}
}
length--;
}
return found;
}
代码示例来源:origin: pentaho/pentaho-kettle
@Override public void mouseUp( MouseEvent mouseEvent ) {
MappingIODefinition definition = new MappingIODefinition();
definition.setMainDataPath( true );
definitions.add( definition );
wInputList.add( tabTitle + ( definitions.size() > 1 ? String.valueOf( definitions.size() ) : "" ) );
wInputList.select( definitions.size() - 1 );
updateFields( definitions.get( wInputList.getSelectionIndex() ), input, wMainPath, wlInputStep, wInputStep,
wbInputStep, wlOutputStep, wOutputStep,
wbOutputStep, wlDescription, wDescription, wFieldMappings, wRenameOutput );
wlNoItems.setVisible( false );
wFieldsComposite.setVisible( true );
wRemoveButton.setEnabled( true );
}
} );
代码示例来源:origin: pentaho/pentaho-kettle
@Override
public void focusLost( FocusEvent event ) {
definitions.get( wInputList.getSelectionIndex() ).setOutputStepname( wOutputStep.getText() );
try {
enableMappingButton( wbEnterMapping, input, wInputStep.getText(), wOutputStep.getText() );
} catch ( KettleException e ) {
// Show the missing/wrong step name error
//
Listener ok = new Listener() {
@Override
public void handleEvent( final Event event ) { /* do nothing for now */ }
};
Map<String, Listener> listenerMap = new LinkedHashMap<>();
listenerMap.put( BaseMessages.getString( "System.Button.OK" ), ok );
new WarningDialog( shell, "Error", e.getMessage(), listenerMap ).open();
//
//new ErrorDialog( shell, "Error", "Unexpected error", e );
}
}
} );
代码示例来源:origin: pentaho/pentaho-kettle
private void show() {
if ( rowDatas.size() == 0 ) {
return;
}
int nr = wStepList.getSelectionIndex();
java.util.List<Object[]> buffer = rowDatas.get( nr );
RowMetaInterface rowMeta = rowMetas.get( nr );
String name = stepNames.get( nr );
if ( rowMeta != null && buffer != null && buffer.size() > 0 ) {
PreviewRowsDialog prd =
new PreviewRowsDialog( shell, Variables.getADefaultVariableSpace(), SWT.NONE, name, rowMeta, buffer );
prd.open();
} else {
MessageBox mb = new MessageBox( shell, SWT.ICON_INFORMATION | SWT.OK );
mb.setText( BaseMessages.getString( PKG, "EnterPreviewRowsDialog.Dialog.NoPreviewRowsFound.Title" ) );
mb.setMessage( BaseMessages.getString( PKG, "EnterPreviewRowsDialog.Dialog.NoPreviewRowsFound.Message" ) );
mb.open();
}
}
}
代码示例来源:origin: pentaho/pentaho-kettle
private boolean findTarget() {
int sourceIndex = wSource.getSelectionIndex();
GuessPair p = findTargetPair( sourceIndex );
if ( p.getFound() ) {
wTarget.setSelection( p.getTargetIndex() );
}
return p.getFound();
}
代码示例来源:origin: pentaho/pentaho-kettle
public void modifyText( ModifyEvent event ) {
// See if there is a selected Validation
//
if ( wValidationsList != null
&& wValidationsList.getItemCount() > 0 && wValidationsList.getSelection().length == 1 ) {
int index = wValidationsList.getSelectionIndex();
String description = wValidationsList.getItem( index );
Validation validation = Validation.findValidation( selectionList, description );
String newDescription = wDescription.getText();
validation.setName( newDescription );
wValidationsList.setItem( index, newDescription );
wValidationsList.select( index );
}
}
} );
代码示例来源:origin: pentaho/pentaho-kettle
private void ok() {
stepname = wStepname.getText(); // return value
input.getParameterFieldMap().clear();
for ( int i = 0; i < wFields.nrNonEmpty(); i++ ) {
TableItem item = wFields.getNonEmpty( i );
String name = item.getText( 1 );
String field = item.getText( 2 );
if ( !Utils.isEmpty( name ) && !Utils.isEmpty( field ) ) {
input.getParameterFieldMap().put( name, field );
}
}
input.setInputFileField( wInput.getText() );
input.setOutputFileField( wOutput.getText() );
input.setOutputProcessorType( ProcessorType.values()[wProcessor.getSelectionIndex()] );
input.setCreateParentfolder( wParentFolder.getSelection() );
dispose();
}
代码示例来源:origin: pentaho/pentaho-kettle
public void setAccessTypes() {
if ( wDBType.getSelectionCount() < 1 ) {
return;
}
int[] acc = DatabaseMeta.getAccessTypeList( wDBType.getSelection()[0] );
wAccType.removeAll();
for ( int i = 0; i < acc.length; i++ ) {
wAccType.add( DatabaseMeta.getAccessTypeDescLong( acc[i] ) );
}
// If nothing is selected: select the first item (mostly the native driver)
if ( wAccType.getSelectionIndex() < 0 ) {
wAccType.select( 0 );
}
}
内容来源于网络,如有侵权,请联系作者删除!