下面列出了org.eclipse.swt.widgets.Combo#removeAll ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private void fillStyles( Combo stylesChooser )
{
stylesChooser.removeAll( );
styles.clear( );
stylesChooser.add( NONE_DISPLAY_TEXT );
for ( Iterator iter = DEUtil.getStyles( ); iter.hasNext( ); )
{
StyleHandle styleHandle = (StyleHandle) iter.next( );
if ( styleHandle.isPredefined( ) )
{
continue;
}
String styleName = styleHandle.getName( );
stylesChooser.add( styleName );
styles.put( styleName, styleHandle );
}
if ( handle != null && handle.getStyle( ) != null )
{
stylesChooser.setText( handle.getStyle( ).getName( ) );
}
else
{
stylesChooser.setText( NONE_DISPLAY_TEXT );
}
}
/**
* 设置Combo下拉列表中的数据
*/
private void setComboData(Combo combo, String[] data) {
if (combo == null || data == null || data.length == 0) {
return;
}
combo.clearSelection();
combo.removeAll();
int i = 0;
for (String temp : data) {
combo.add(temp, i++);
}
}
/**
* 设置Combo下拉列表中的数据
*/
private void setComboData(Combo combo, String[] data) {
if (combo == null || data == null || data.length == 0) {
return;
}
combo.clearSelection();
combo.removeAll();
int i = 0;
for (String temp : data) {
combo.add(temp, i++);
}
}
private void refreshSeriesCombo( Combo cmbSeriesSelect )
{
ArrayList<String> itemList = new ArrayList<String>( );
int seriesSize = seriesDefns.size( );
for ( int i = 1; i <= seriesSize; i++ )
{
itemList.add( selectionName + " " + i ); //$NON-NLS-1$
}
if( !isPartChart( ) )
{
itemList.add( Messages.getString( "DataDefinitionSelector.Text.NewSeries" ) ); //$NON-NLS-1$
}
cmbSeriesSelect.removeAll( );
cmbSeriesSelect.setItems( itemList.toArray( new String[seriesSize] ) );
}
/**
* @wbp.parser.entryPoint
*/
@Override
public void createControl(Composite parent) {
Composite comp = new Composite(parent, SWT.NONE);
setControl(comp);
comp.setLayout(new GridLayout(1, false));
Group grpProject = new Group(comp, SWT.NONE);
grpProject.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
grpProject.setText("Project");
grpProject.setLayout(new GridLayout(3, false));
Label lblProject = new Label(grpProject, SWT.NONE);
lblProject.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblProject.setText("Project:");
textProject = new Text(grpProject, SWT.BORDER);
textProject.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
textProject.addListener(SWT.Modify, dirtyListener);
Button btnProjectBrowse = new Button(grpProject, SWT.NONE);
btnProjectBrowse.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
ElementListSelectionDialog es = new ElementListSelectionDialog(getShell(), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider());
es.setTitle("Project Selection");
es.setMessage("Select a project to run");
es.setElements(HybridCore.getHybridProjects().toArray());
if (es.open() == Window.OK) {
HybridProject project = (HybridProject) es.getFirstResult();
textProject.setText(project.getProject().getName());
}
}
});
btnProjectBrowse.setText("Browse...");
Group grpEmulator = new Group(comp, SWT.NONE);
grpEmulator.setLayout(new GridLayout(2, false));
grpEmulator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
grpEmulator.setText("Emulator");
Label lblVirtualDeviceavd = new Label(grpEmulator, SWT.NONE);
lblVirtualDeviceavd.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblVirtualDeviceavd.setText("Virtual Device (AVD):");
AVDCombo = new Combo(grpEmulator, SWT.READ_ONLY);
AVDCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
AVDCombo.add("", 0);
AVDCombo.addListener(SWT.Selection, dirtyListener);
Label lblLogFilter = new Label(grpEmulator, SWT.NONE);
lblLogFilter.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblLogFilter.setText("Log Filter:");
logFilterTxt = new Text(grpEmulator, SWT.BORDER);
logFilterTxt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
logFilterTxt.addListener(SWT.Modify, dirtyListener);
try {
AndroidSDKManager sdk = AndroidSDKManager.getManager();
avds = sdk.listAVDs();
for (AndroidAVD avd : avds) {
AVDCombo.add(avd.getName());
}
} catch (CoreException e1) {
AVDCombo.removeAll();// let it fallback to default
}
}
/**
* Setups gateway SWT controls by populating a gateway combobox and configuring an information
* Label and the enabling checkbox.
*
* @param combo {@link Combo} selector to populate with discovered gateways
* @param info {@link Label} displaying status information of the discovery
* @param checkbox {@link Button} checkbox to enable/disable UPnP support
*/
private void populateGatewaySelectionControls(
List<GatewayDevice> gateways, final Combo combo, final Label info, final Button checkbox) {
combo.setEnabled(false);
checkbox.setEnabled(false);
combo.removeAll();
// if no devices are found, return now - nothing to populate
if (gateways == null || gateways.isEmpty()) {
info.setText(Messages.UPnPUIUtils_no_gateway);
info.getParent().pack();
return;
}
this.gateways = new ArrayList<GatewayDevice>();
// insert found gateways into combobox
for (GatewayDevice gw : gateways) {
try {
String name = gw.getFriendlyName();
if (!gw.isConnected()) name += Messages.UPnPUIUtils_disconnected;
combo.add(name);
this.gateways.add(gw);
} catch (Exception e) {
log.debug("Error updating UPnP selector:" + e.getMessage()); // $NON-NLS-1$
// ignore faulty gateway
}
}
// if valid gateway found, show info and enable
if (combo.getItemCount() > 0) {
checkbox.setEnabled(true);
combo.setEnabled(true);
combo.select(0);
combo.pack();
info.setVisible(false);
} else {
info.setText(Messages.UPnPUIUtils_no_valid_gateway);
}
info.getParent().pack();
}
/**
* Updates the given combo with the given content.
*
* @param combo
* combo to be updated
* @param content
* to be put into the combo
*/
private static void updateCombo(Combo combo, List<String> content) {
combo.removeAll();
for (int i = 0; i < content.size(); i++) {
combo.add(content.get(i).toString());
}
}
/**
* Updates the given combo with the given content.
* @param combo
* combo to be updated
* @param content
* to be put into the combo
*/
private void updateCombo(Combo combo, List<String> content) {
combo.removeAll();
for (int i = 0; i < content.size(); i++) {
combo.add(content.get(i));
}
}
/**
* Updates the given combo with the given content.
* @param combo
* combo to be updated
* @param content
* to be put into the combo
*/
private void updateCombo(Combo combo, List<String> content) {
combo.removeAll();
for (int i = 0; i < content.size(); i++) {
combo.add(content.get(i));
}
}
/**
* Updates the given combo with the given content.
* @param combo
* combo to be updated
* @param content
* to be put into the combo
*/
private void updateCombo(Combo combo, List<String> content) {
combo.removeAll();
for (int i = 0; i < content.size(); i++) {
combo.add(content.get(i));
}
}
/**
* Updates the given combo with the given content.
* @param combo
* combo to be updated
* @param content
* to be put into the combo
*/
private void updateCombo(Combo combo, List<String> content) {
combo.removeAll();
for (int i = 0; i < content.size(); i++) {
combo.add(content.get(i));
}
}
/**
* Updates the given combo with the given content.
* @param combo
* combo to be updated
* @param content
* to be put into the combo
*/
private void updateCombo(Combo combo, List<String> content) {
combo.removeAll();
for (int i = 0; i < content.size(); i++) {
combo.add(content.get(i));
}
}
/**
* Updates the given combo with the given content.
* @param combo
* combo to be updated
* @param content
* to be put into the combo
*/
private void updateCombo(Combo combo, List<String> content) {
combo.removeAll();
for (int i = 0; i < content.size(); i++) {
combo.add(content.get(i));
}
}