本文整理匯總了Java中org.eclipse.swt.widgets.Combo.select方法的典型用法代碼示例。如果您正苦於以下問題:Java Combo.select方法的具體用法?Java Combo.select怎麽用?Java Combo.select使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.Combo
的用法示例。
在下文中一共展示了Combo.select方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createDialogArea
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
@Override
protected Control createDialogArea(Composite parentShell) {
Composite parent = (Composite) super.createDialogArea(parentShell);
Composite c = new Composite(parent, SWT.NONE);
c.setLayout(new GridLayout(2, false));
Label l = new Label(c, SWT.NONE);
l.setText("Select device: ");
final Combo combo = new Combo(c, SWT.BORDER | SWT.READ_ONLY);
combo.setItems(mDeviceNames);
int defaultSelection =
sSelectedDeviceIndex < mDevices.size() ? sSelectedDeviceIndex : 0;
combo.select(defaultSelection);
sSelectedDeviceIndex = defaultSelection;
combo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
sSelectedDeviceIndex = combo.getSelectionIndex();
}
});
return parent;
}
示例2: createAssertionCombo
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private Combo createAssertionCombo ()
{
final Combo c = new Combo ( this, SWT.NONE );
for ( final Assertion assertion : Assertion.values () )
{
c.add ( assertion.toString () );
}
c.select ( 0 );
c.addSelectionListener ( new SelectionAdapter () {
@Override
public void widgetSelected ( final SelectionEvent e )
{
AssertionComposite.this.orCondition.updateFilter ();
}
} );
final RowData rowData = new RowData ();
rowData.width = 75;
c.setLayoutData ( rowData );
return c;
}
示例3: addCombovalues
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private void addCombovalues(Combo combo, String paramType) {
if(!PrimitiveType.isPrimitiveSig(paramType)) {
String sel = combo.getText();
combo.removeAll();
combo.add("null");
IType owner = (IType) method.getParent();
try {
IField[] fields = owner.getFields();
for(IField f : fields)
if(Flags.isStatic(f.getFlags()) && f.getTypeSignature().equals(paramType))
combo.add(f.getElementName());
} catch (JavaModelException e1) {
e1.printStackTrace();
}
if(sel.isEmpty())
combo.select(0);
else
combo.setText(sel);
}
}
示例4: populateCombo
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/**
* Populates the combo with the specified values. The specified initial
* value is set as the initial selection it it appears in the array of
* values, otherwise the first value is selected.
*
* @param combo
* The combo to populate.
*
* @param values
* The values for the combo drop down.
*
* @param initialValue
* The value which should be the initial selected value.
*
* @return The index of the selected item.
*/
public static int populateCombo(final Combo combo, final String[] values, final String initialValue) {
Check.notNull(combo, "combo"); //$NON-NLS-1$
Check.notNull(values, "values"); //$NON-NLS-1$
if (values.length == 0) {
return -1;
}
int selectedIndex = 0;
for (int i = 0; i < values.length; i++) {
final String value = values[i];
if (value.equals(initialValue)) {
selectedIndex = i;
}
combo.add(value);
}
combo.select(selectedIndex);
setVisibleItemCount(combo);
return selectedIndex;
}
示例5: addInverseChooser
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/**
* Creates the additional controls of the page.
* @param parent parent component
*/
private void addInverseChooser(Composite parent) {
Label label = new Label(parent, SWT.LEFT);
label.setText(TexlipsePlugin.getResourceString("preferenceViewerInverseLabel"));
label.setToolTipText(TexlipsePlugin.getResourceString("preferenceViewerInverseTooltip"));
label.setLayoutData(new GridData());
String[] list = new String[] {
TexlipsePlugin.getResourceString("preferenceViewerInverseSearchNo"),
TexlipsePlugin.getResourceString("preferenceViewerInverseSearchRun"),
TexlipsePlugin.getResourceString("preferenceViewerInverseSearchStd")
};
// find out which option to choose by default
int index = inverseSearchValues.length - 1;
for (; index > 0 && !inverseSearchValues[index].equals(registry.getInverse()); index--) {}
inverseChooser = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
inverseChooser.setLayoutData(new GridData());
inverseChooser.setToolTipText(TexlipsePlugin.getResourceString("preferenceViewerInverseTooltip"));
inverseChooser.setItems(list);
inverseChooser.select(index);
}
示例6: createDialogArea
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/**
* Create contents of the dialog.
* @param parent
*/
@Override protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
container.setLayout(new GridLayout(2, false));
label = new Label(container, 0);
label.setText(labelTxt);
combo = new Combo(container, SWT.READ_ONLY | SWT.DROP_DOWN);
combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
combo.addModifyListener(new ModifyListener() {
@Override public void modifyText(ModifyEvent e) {
updateVals();
}
});
combo.setItems(items);
combo.select(0);
updateVals();
container.pack();
return container;
}
示例7: createAttributeCombo
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private Combo createAttributeCombo ()
{
final Combo c = new Combo ( this, SWT.NONE );
c.add ( "sourceTimestamp" ); //$NON-NLS-1$
c.add ( "entryTimestamp" ); //$NON-NLS-1$
for ( final Event.Fields field : Event.Fields.values () )
{
c.add ( field.getName () );
}
c.add ( Messages.custom_field );
c.select ( 0 );
return c;
}
示例8: createTypeCombo
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private Combo createTypeCombo ()
{
final Combo c = new Combo ( this, SWT.NONE );
for ( final Type type : Type.values () )
{
c.add ( type.name () );
}
c.select ( 0 );
return c;
}
示例9: CreateCombo
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/**
* Create Combo Widget
* @param control
* @param widgetName
* @return
*/
public Widget CreateCombo(Composite control, String[] widgetName){
Combo combo = new Combo(control, SWT.READ_ONLY);
combo.setItems(widgetName);
combo.select(0);
GridData gd_partitionKeyButton = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
gd_partitionKeyButton.horizontalIndent = 10;
combo.setLayoutData(gd_partitionKeyButton);
return combo;
}
示例10: comboWidget
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
public Combo comboWidget(Composite parent, int style, int[] bounds,
String[] items, int selectionIndex) {
Combo comboBox = new Combo(parent, style);
comboBox.setBounds(bounds[0], bounds[1], bounds[2], bounds[3]);
comboBox.setItems(items);
comboBox.select(selectionIndex);
return comboBox;
}
示例11: createControl
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
public void createControl(Composite parent) {
super.createControl(parent);
Composite composite = (Composite) getControl();
Group group = new Group(composite, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
group.setLayout(layout);
group.setText("設置");
group.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
Label label = new Label(group, SWT.NULL);
label.setText("數據庫方言:");
final Combo combo = new Combo(group, SWT.READ_ONLY);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
combo.setLayoutData(gd);
DbType[] values = DbType.values();
for (DbType type : values) {
combo.add(type.name());
}
combo.select(0);
currentDbType = combo.getText();
setFileName("NewFile" + DEFAULT_EXTENSION);
combo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
currentDbType = combo.getText();
}
});
setPageComplete(validatePage());
}
示例12: createDecisionCombo
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/**
* Creates a new combo box, initilizes the enty values, and configures
* it with a listener capable of updating the right entry in our
* map of item->decision.
*/
private Combo createDecisionCombo(Composite parent, Task item) {
Combo combo = new Combo(parent, SWT.READ_ONLY);
combo.add(YES);
combo.add(NO);
combo.add(NEVER);
combo.select(0);
combo.addSelectionListener(new ComboListener(item));
return combo;
}
示例13: populateTreeOptionsCombo
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private void populateTreeOptionsCombo(final Combo combo, final String initialValue) {
int selectedItemIndex = 0;
final ArrayList list = new ArrayList();
mapTreeDisplayNameToReferenceName = new HashMap();
final WorkItemLinkTypeCollection linkTypes = query.getWorkItemClient().getLinkTypes();
final WorkItemLinkTypeEndCollection endTypes = linkTypes.getLinkTypeEnds();
for (final Iterator it = endTypes.iterator(); it.hasNext();) {
final WorkItemLinkTypeEnd end = (WorkItemLinkTypeEnd) it.next();
if (end.getLinkType().getLinkTopology() == Topology.TREE && end.isForwardLink()) {
final String referenceName = end.getImmutableName();
final String display =
MessageFormat.format(Messages.getString("QueryEditorControl.HierarchyLinkTypeFormat"), new Object[] //$NON-NLS-1$
{
end.getOppositeEnd().getName(),
end.getName()
});
if (referenceName.equalsIgnoreCase(initialValue)) {
selectedItemIndex = list.size();
}
list.add(display);
mapTreeDisplayNameToReferenceName.put(display, referenceName);
}
}
combo.setItems((String[]) list.toArray(new String[list.size()]));
if (combo.getItemCount() > 0) {
combo.select(selectedItemIndex);
}
combo.addSelectionListener(new ComboTreeOptionsSelectionHandler());
}
示例14: setWordValue
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private void setWordValue(final Combo combo, final NormalColumn targetColumn) {
Word word = targetColumn.getWord();
while (word instanceof CopyWord) {
word = ((CopyWord) word).getOriginal();
}
if (word != null) {
final int index = wordList.indexOf(word);
combo.select(index + 1);
}
}
示例15: ProjectComboField
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
public ProjectComboField(Composite composite, int config, IProjectFilter filter) {
combo = new Combo(composite, config);
combo.add(NO_PROJECT);
combo.select(0);
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
for (IProject project : projects) {
if (filter == null || filter.accept(project))
combo.add(project.getName());
}
}