本文整理匯總了Java中org.eclipse.swt.widgets.Combo類的典型用法代碼示例。如果您正苦於以下問題:Java Combo類的具體用法?Java Combo怎麽用?Java Combo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Combo類屬於org.eclipse.swt.widgets包,在下文中一共展示了Combo類的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: createCombo
import org.eclipse.swt.widgets.Combo; //導入依賴的package包/類
/**
* This method initializes combo
*
*/
private void createCombo() {
GridData gridData1 = new GridData();
gridData1.grabExcessHorizontalSpace = false;
gridData1.verticalAlignment = GridData.CENTER;
gridData1.horizontalAlignment = GridData.BEGINNING;
combo = new Combo(this, SWT.NONE);
combo.setLayoutData(gridData1);
combo.add("*");
combo.add("Screen class");
combo.add("Criteria");
combo.add("Extraction rule");
combo.add("Sheet");
combo.add("Transaction");
combo.add("Statement");
combo.add("Sequence");
combo.add("Step");
}
示例3: addDragSupport
import org.eclipse.swt.widgets.Combo; //導入依賴的package包/類
private void addDragSupport(final List sourcePackageList, final Combo comboJarList) {
DragSource dragSource = ExpressionEditorUtil.INSTANCE.getDragSource(sourcePackageList);
dragSource.addDragListener(new DragSourceAdapter() {
public void dragSetData(DragSourceEvent event) {
event.data = formatDataToTransfer(sourcePackageList.getSelection());
}
private Object formatDataToTransfer(String[] selection) {
StringBuffer buffer = new StringBuffer();
for (String field : selection) {
buffer.append(field + Constants.DOT + Constants.ASTERISK + SWT.SPACE + Constants.DASH + SWT.SPACE
+ comboJarList.getItem(comboJarList.getSelectionIndex())
+ Constants.FIELD_SEPRATOR_FOR_DRAG_DROP);
}
return buffer.toString();
}
});
}
示例4: createDialogArea
import org.eclipse.swt.widgets.Combo; //導入依賴的package包/類
protected Control createDialogArea(Composite parent) {
Composite area = (Composite) super.createDialogArea(parent);
Composite container = new Composite(area, SWT.NONE);
RowLayout layout = new RowLayout(SWT.HORIZONTAL);
container.setLayout(layout);
// container.setLayoutData(new GridData(GridData.FILL_BOTH));
// TitleArea中的Title
setTitle("屬性文件更新");
// TitleArea中的Message
setMessage("輸入正確的url地址,以更新文件。\n可提示的屬性數量會根據當前項目存在的jar包,對已有屬性增加或者刪除!");
Label label = new Label(container, SWT.NONE);
label.setText("項目URL: ");
combo = new Combo(container, SWT.DROP_DOWN);
String[] items = new String[getUrlMap().size()];
getUrlMap().values().toArray(items);
combo.setItems(items);
String url = getPreferedUrl(projectName);
combo.setText(url);
combo.setLayoutData(new RowData(400, 30));
return area;
}
示例5: createStandardCombo
import org.eclipse.swt.widgets.Combo; //導入依賴的package包/類
public void createStandardCombo ( final Composite parent, final String attributeName, final String label, final String[] items, final IObservableMap data, final Object valueType )
{
this.toolkit.createLabel ( parent, label + ":" );
final Combo combo = new Combo ( parent, SWT.DROP_DOWN );
combo.setItems ( items );
this.toolkit.adapt ( combo );
final GridData gd = new GridData ( GridData.FILL, GridData.BEGINNING, true, true );
gd.horizontalSpan = 2;
combo.setLayoutData ( gd );
final IObservableValue value = Observables.observeMapEntry ( data, attributeName, valueType );
this.dbc.bindValue ( WidgetProperties.text ().observe ( combo ), value );
}
示例6: 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;
}
示例7: createControl
import org.eclipse.swt.widgets.Combo; //導入依賴的package包/類
@Override
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
GridLayout gridLayout = new GridLayout();
container.setLayout(gridLayout);
skip(container);
Label explanation = new Label(container, SWT.NONE);
explanation.setText(MessageUtil.getString("choose_the_execution_context_you_want_to_extend"));
skip(container);
ComboViewer comboViewer = new ComboViewer(container, SWT.NONE);
Combo combo = comboViewer.getCombo();
combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
loadAncestor(model);
setupAncestor(comboViewer);
setControl(container);
}
示例8: attachWidget
import org.eclipse.swt.widgets.Combo; //導入依賴的package包/類
@Override
public void attachWidget(Composite container) {
defaultELTcom = new Combo(container, SWT.READ_ONLY);
defaultELTcom.setItems(defaultTextMessage);
// defaultELTcom.setItems(new String[] {"True","false"});
// defaultELTcom.setItem(0, "");
GridData gd_defaultELTTextBox = new GridData(SWT.FILL, SWT.FILL, false,
false, 1, 1);
if (OSValidator.isMac()) {
gd_defaultELTTextBox.horizontalIndent=-1;
gd_defaultELTTextBox.widthHint = textboxWidth+50;
}
else{
gd_defaultELTTextBox.horizontalIndent=1;
gd_defaultELTTextBox.widthHint = textboxWidth;
}
defaultELTcom.setLayoutData(gd_defaultELTTextBox);
widget = defaultELTcom;
}
示例9: disabledWidgetsifWholeExpressionIsParameterForAggregateCumulate
import org.eclipse.swt.widgets.Combo; //導入依賴的package包/類
/**
* @param isParam
* @param isWholeOperationParameter
*/
private void disabledWidgetsifWholeExpressionIsParameterForAggregateCumulate(Button isParam,
boolean isWholeOperationParameter) {
if (isWholeOperationParameter) {
Text textAccumulator = (Text) isParam.getData(Messages.TEXT_ACCUMULATOR);
Button isParamAccumulator = (Button) isParam.getData(Messages.ISPARAM_ACCUMULATOR);
Combo comboDataTypes = (Combo) isParam.getData(Messages.COMBODATATYPES);
Button button =(Button) isParam.getData(Constants.EXPRESSION_EDITOR_BUTTON1);
button.setEnabled(false);
textAccumulator.setEnabled(false);
isParamAccumulator.setEnabled(false);
comboDataTypes.setEnabled(false);
super.disabledWidgetsifWholeExpressionIsParameter(isParamAccumulator, isWholeOperationParameter);
}
}
示例10: addModifyListenerToComboDataTypes
import org.eclipse.swt.widgets.Combo; //導入依賴的package包/類
private void addModifyListenerToComboDataTypes(Combo combo,final AbstractExpressionComposite expressionComposite,MappingSheetRow mappingSheetRow) {
combo.addModifyListener(new ModifyListener(){
@Override
public void modifyText(ModifyEvent e) {
Combo accumulatorDataType =(Combo)e.widget;
mappingSheetRow.setComboDataType( accumulatorDataType.getText());
boolean isValidValue = validate(expressionComposite.getTextAccumulator().getText(),accumulatorDataType.getText());
if(!isValidValue){
expressionComposite.getTextAccumulator().setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255,255,000));
}else{
expressionComposite.getTextAccumulator().setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry( 255,255,255));
}
showHideValidationMessage();
}
});
}
示例11: getListener
import org.eclipse.swt.widgets.Combo; //導入依賴的package包/類
@Override
public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper, Widget... widgets) {
final Widget[] widgetList = widgets;
if (helper != null) {
txtDecorator = (ControlDecoration) helper.get(HelperType.CONTROL_DECORATION);
}
Listener listener = new Listener() {
@Override
public void handleEvent(Event event) {
if (((Combo) widgetList[0]).getText().equals("Parameter") || ((Combo) widgetList[0]).getText().equals("Others")) {
((Text) widgetList[1]).setVisible(true);
((Text) widgetList[1]).setFocus();
txtDecorator.hide();
} else {
((Text) widgetList[1]).setVisible(false);
txtDecorator.hide();
}
propertyDialogButtonBar.enableApplyButton(true);
}
};
return listener;
}
示例12: getListener
import org.eclipse.swt.widgets.Combo; //導入依賴的package包/類
@Override
public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar, final ListenerHelper helpers, Widget... widgets) {
final Widget[] widgetList = widgets;
if (helpers != null) {
widgetConfig = (WidgetConfig) helpers.get(HelperType.WIDGET_CONFIG);
}
Listener listener=new Listener() {
@Override
public void handleEvent(Event event) {
String comboValue = ((Combo) widgetList[0]).getText();
if (comboValue.equals(Messages.CUSTOM)) {
FilterOperationClassUtility.INSTANCE.createNewClassWizard((Text) widgetList[1], widgetConfig);
if(helpers.get(HelperType.OPERATION_CLASS_DIALOG_OK_CONTROL) instanceof OperationClassDialog)
{
OperationClassDialog operationClassDialog=(OperationClassDialog)helpers.get(HelperType.OPERATION_CLASS_DIALOG_OK_CONTROL);
operationClassDialog.getShell().setFocus();
}
propertyDialogButtonBar.enableApplyButton(true);
}
}
};
return listener;
}
示例13: getListener
import org.eclipse.swt.widgets.Combo; //導入依賴的package包/類
@Override
public Listener getListener(final PropertyDialogButtonBar propertyDialogButtonBar, ListenerHelper helper,
Widget... widgets) {
final Widget[] widgetList = widgets;
Listener listener = new Listener() {
@Override
public void handleEvent(Event event) {
if (StringUtils.equalsIgnoreCase(((Combo) widgetList[0]).getText(), String.valueOf(Boolean.TRUE))) {
MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(),
SWT.ICON_INFORMATION | SWT.OK);
messageBox.setText(INFORMATION);
messageBox.setMessage("All files at given location will be overwritten.");
messageBox.open();
}
}
};
return listener;
}
示例14: addVersionSection
import org.eclipse.swt.widgets.Combo; //導入依賴的package包/類
private void addVersionSection(Composite parent) {
Composite composite = createDefaultComposite(parent);
// Label for owner field
Label ownerLabel = new Label(composite, SWT.NONE);
ownerLabel.setText(LEGACY_VERSION_TITLE);
// Owner text field
legacyVersionCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
GridData gd = new GridData();
gd.widthHint = convertWidthInCharsToPixels(COMBO_FIELD_WIDTH);
legacyVersionCombo.setLayoutData(gd);
// Populate owner text field
LegacyVersion legacyVersion = LegacyManager.getInstance().getVersion(getProject());
legacyVersionCombo.setItems(LegacyVersion.names());
legacyVersionCombo.setText(legacyVersion.name());
}
示例15: IntListParameter
import org.eclipse.swt.widgets.Combo; //導入依賴的package包/類
public IntListParameter(Composite composite, final String name,
int defaultValue, final String labels[], final int values[]) {
super(name);
this.name = name;
this.values = values;
if(labels.length != values.length)
return;
int value = COConfigurationManager.getIntParameter(name,defaultValue);
int index = findIndex(value,values);
list = new Combo(composite,SWT.SINGLE | SWT.READ_ONLY);
for(int i = 0 ; i < labels.length ;i++) {
list.add(labels[i]);
}
setIndex(index);
list.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
setIndex(list.getSelectionIndex());
}
});
}