本文整理汇总了Java中org.eclipse.swt.custom.CCombo.setItems方法的典型用法代码示例。如果您正苦于以下问题:Java CCombo.setItems方法的具体用法?Java CCombo.setItems怎么用?Java CCombo.setItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.custom.CCombo
的用法示例。
在下文中一共展示了CCombo.setItems方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createControl
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
protected Control createControl() {
m_Combo = new CCombo(m_Table, SWT.READ_ONLY);
m_Combo.setBackground(Display.getCurrent().getSystemColor(
SWT.COLOR_LIST_BACKGROUND));
if (m_Items != null)
m_Combo.setItems(m_Items);
m_Combo.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
try {
onKeyPressed(e);
} catch (Exception ex) {
}
}
});
/*
* m_Combo.addTraverseListener(new TraverseListener() { public void
* keyTraversed(TraverseEvent arg0) { onTraverse(arg0); } });
*/
return m_Combo;
}
示例2: addComboInTable
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private CCombo addComboInTable(TableViewer tableViewer, TableItem tableItem, String comboName, String comboPaneName,
String editorName, int columnIndex, String[] relationalOperators, SelectionListener dropDownSelectionListener,
ModifyListener modifyListener,FocusListener focusListener) {
final Composite buttonPane = new Composite(tableViewer.getTable(), SWT.NONE);
buttonPane.setLayout(new FillLayout());
final CCombo combo = new CCombo(buttonPane, SWT.NONE);
combo.setItems(relationalOperators);
combo.setData(FilterConstants.ROW_INDEX, tableViewer.getTable().indexOf(tableItem));
tableItem.setData(comboName, combo);
tableItem.setData(comboPaneName, buttonPane);
combo.addSelectionListener(dropDownSelectionListener);
combo.addModifyListener(modifyListener);
combo.addFocusListener(focusListener);
new AutoCompleteField(combo, new CComboContentAdapter(), combo.getItems());
final TableEditor editor = new TableEditor(tableViewer.getTable());
editor.grabHorizontal = true;
editor.grabVertical = true;
editor.setEditor(buttonPane, tableItem, columnIndex);
editor.layout();
combo.setData(editorName, editor);
return combo;
}
示例3: getFieldNameModifyListener
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
/**
* Gets the field name modify listener.
*
* @param tableViewer
* the table viewer
* @param conditionsList
* the conditions list
* @param fieldsAndTypes
* the fields and types
* @param fieldNames
* the field names
* @param saveButton
* the save button
* @param displayButton
* the display button
* @return the field name modify listener
*/
public ModifyListener getFieldNameModifyListener(final TableViewer tableViewer, final List<Condition> conditionsList,
final Map<String, String> fieldsAndTypes, final String[] fieldNames, final Button saveButton, final Button displayButton) {
ModifyListener listener = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
CCombo source = (CCombo) e.getSource();
int index = (int) source.getData(FilterConstants.ROW_INDEX);
Condition filterConditions = conditionsList.get(index);
String fieldName = source.getText();
filterConditions.setFieldName(fieldName);
if(StringUtils.isNotBlank(fieldName)){
String fieldType = fieldsAndTypes.get(fieldName);
TableItem item = tableViewer.getTable().getItem(index);
CCombo conditionalCombo = (CCombo) item.getData(FilterConditionsDialog.CONDITIONAL_OPERATORS);
if(conditionalCombo != null && StringUtils.isNotBlank(fieldType)){
conditionalCombo.setText(filterConditions.getConditionalOperator());
conditionalCombo.setItems(FilterHelper.INSTANCE.getTypeBasedOperatorMap().get(fieldType));
new AutoCompleteField(conditionalCombo, new CComboContentAdapter(), conditionalCombo.getItems());
}
}
validateCombo(source);
toggleSaveDisplayButton(conditionsList, fieldsAndTypes, fieldNames, saveButton, displayButton);
}
};
return listener;
}
示例4: createCombo
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
protected CCombo createCombo(Composite parent, String label, IJSONPath path, String[] values, String defaultValue) {
FormToolkit toolkit = getToolkit();
Composite composite = toolkit.createComposite(parent, SWT.NONE);
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
GridLayout layout = new GridLayout(2, false);
layout.marginWidth = 0;
layout.marginBottom = 0;
layout.marginTop = 0;
layout.marginHeight = 0;
layout.verticalSpacing = 0;
composite.setLayout(layout);
toolkit.createLabel(composite, label);
CCombo combo = new CCombo(composite, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
combo.setItems(values);
toolkit.adapt(combo, true, false);
bind(combo, path, defaultValue);
return combo;
}
示例5: createMatchModeCombo
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private void createMatchModeCombo(Composite parent) {
// draw label
Label comboLabel = new Label(parent,SWT.LEFT);
comboLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
comboLabel.setText(LogViewerPlugin.getResourceString("preferences.ruleseditor.dialog.matchmode.label")); //$NON-NLS-1$
// draw combo
matchModeCombo = new CCombo(parent,SWT.BORDER);
matchModeCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
matchModeCombo.setEditable(false);
String[] matchModes = {LogViewerPlugin.getResourceString("preferences.ruleseditor.dialog.matchmode.entry.find"), LogViewerPlugin.getResourceString("preferences.ruleseditor.dialog.matchmode.entry.match")};
matchModeCombo.setItems(matchModes);
if(edit) {
String[] items = matchModeCombo.getItems();
for(int i = 0 ; i < items.length ; i++) {
if(items[i].toLowerCase().indexOf(this.data.getMatchMode())!=-1) {
matchModeCombo.select(i);
return;
}
}
}
}
示例6: PopulateFields
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private void PopulateFields( CCombo cc ) {
if ( cc.isDisposed() ) {
return;
}
try {
String initValue = cc.getText();
cc.removeAll();
RowMetaInterface r = transMeta.getPrevStepFields( stepname );
if ( r != null ) {
cc.setItems( r.getFieldNames() );
}
if ( !Const.isEmpty( initValue ) ) {
cc.setText( initValue );
}
} catch ( KettleException ke ) {
new ErrorDialog(
shell, BaseMessages.getString( PKG, "XsltDialog.FailedToGetFields.DialogTitle" ), BaseMessages
.getString( PKG, "XsltDialog.FailedToGetFields.DialogMessage" ), ke );
}
}
示例7: getFieldsInto
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private void getFieldsInto( CCombo fieldCombo ) {
try {
if ( !gotPreviousFields ) {
previousFields = transMeta.getPrevStepFields( stepname );
}
String field = fieldCombo.getText();
if ( previousFields != null ) {
fieldCombo.setItems( previousFields.getFieldNames() );
}
if ( field != null ) {
fieldCombo.setText( field );
}
gotPreviousFields = true;
} catch ( KettleException ke ) {
new ErrorDialog( shell, BaseMessages.getString( PKG, "HazelcastInputDialog.FailedToGetFields.DialogTitle" ),
BaseMessages.getString( PKG, "HazelcastInputDialog.FailedToGetFields.DialogMessage" ), ke );
}
}
示例8: getFieldsInto
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private void getFieldsInto( CCombo fieldCombo ) {
try {
if ( !gotPreviousFields ) {
previousFields = transMeta.getPrevStepFields( stepname );
}
String field = fieldCombo.getText();
if ( previousFields != null ) {
fieldCombo.setItems( previousFields.getFieldNames() );
}
if ( field != null ) {
fieldCombo.setText( field );
}
gotPreviousFields = true;
} catch ( KettleException ke ) {
new ErrorDialog( shell, BaseMessages.getString( PKG, "HazelcastOutputDialog.FailedToGetFields.DialogTitle" ),
BaseMessages.getString( PKG, "HazelcastOutputDialog.FailedToGetFields.DialogMessage" ), ke );
}
}
示例9: getFieldsInto
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private void getFieldsInto( CCombo fieldCombo ) {
try {
if ( !gotPreviousFields ) {
previousFields = transMeta.getPrevStepFields( stepname );
}
String field = fieldCombo.getText();
if ( previousFields != null ) {
fieldCombo.setItems( previousFields.getFieldNames() );
}
if ( field != null )
fieldCombo.setText( field );
gotPreviousFields = true;
} catch ( KettleException ke ) {
new ErrorDialog( shell, BaseMessages.getString( PKG, "MemcachedInputDialog.FailedToGetFields.DialogTitle" ),
BaseMessages.getString( PKG, "MemcachedInputDialog.FailedToGetFields.DialogMessage" ), ke );
}
}
示例10: getFieldsInto
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private void getFieldsInto( CCombo fieldCombo ) {
try {
if ( !gotPreviousFields ) {
previousFields = transMeta.getPrevStepFields( stepname );
}
String field = fieldCombo.getText();
if ( previousFields != null ) {
fieldCombo.setItems( previousFields.getFieldNames() );
}
if ( field != null )
fieldCombo.setText( field );
gotPreviousFields = true;
} catch ( KettleException ke ) {
new ErrorDialog( shell, BaseMessages.getString( PKG, "MemcachedOutputDialog.FailedToGetFields.DialogTitle" ),
BaseMessages.getString( PKG, "MemcachedOutputDialog.FailedToGetFields.DialogMessage" ), ke );
}
}
示例11: PopulateFields
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private void PopulateFields(CCombo cc)
{
if(cc.isDisposed()) return;
try{
String initValue=cc.getText();
cc.removeAll();
RowMetaInterface r = transMeta.getPrevStepFields(stepname);
if (r!=null) {
cc.setItems(r.getFieldNames());
}
if(!Const.isEmpty(initValue)) cc.setText(initValue);
}catch(KettleException ke){
new ErrorDialog(shell, BaseMessages.getString(PKG, "XsltDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "XsltDialog.FailedToGetFields.DialogMessage"), ke); //$NON-NLS-1$ //$NON-NLS-2$
}
}
示例12: createLabelledCombo
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private CCombo createLabelledCombo(Composite content, String slabel) {
Label label = new Label(content, SWT.NONE);
label.setBackground(content.getDisplay().getSystemColor(SWT.COLOR_WHITE));
label.setText(" "+slabel+" ");
label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, true));
CCombo ret = new CCombo(content, SWT.READ_ONLY|SWT.BORDER);
ret.setItems(getNames());
GridData fill = new GridData(SWT.FILL, SWT.CENTER, true, true);
fill.widthHint=100;
ret.setLayoutData(fill);
return ret;
}
示例13: createTopComposite
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private void createTopComposite(Composite main_composite) {
top_composite = new Composite(main_composite, SWT.NONE);
top_composite.setLayout(new GridLayout(4, false));
GridData gd_composite_1 = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
gd_composite_1.heightHint = 45;
top_composite.setLayoutData(gd_composite_1);
Label applyAllLabel = new Label(top_composite, SWT.NONE);
applyAllLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
applyAllLabel.setText(Messages.REMAINING_FIELDS);
applyAllLabel.setToolTipText(Messages.REMAINING_FIELDS_TOOLTIP);
combo = new CCombo(top_composite, SWT.NONE);
GridData gd_combo = new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1);
gd_combo.widthHint = 143;
combo.setLayoutData(gd_combo);
draggedFields.add(0,"Select");
combo.setItems(convertToArray(draggedFields));
combo.select(0);
Composite composite_2 = new Composite(top_composite, SWT.NONE);
composite_2.setLayout(new GridLayout(3, false));
composite_2.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, true, true, 1, 1));
deleteButton = new Button(composite_2, SWT.NONE);
deleteButton.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, true, false, 1, 1));
deleteButton.setImage(ImagePathConstant.DELETE_BUTTON.getImageFromRegistry());
attachDeleteButtonListener(deleteButton);
deleteButton.setEnabled(false);
}
示例14: createLogLevelGroup
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
/**
* @param logLevel
*
*/
private void createLogLevelGroup(String logLevel) {
HydroGroup hydroGroup = new HydroGroup(this, SWT.NONE);
hydroGroup.setHydroGroupText(Messages.LOG_LEVEL_PREF_MESSAGE);
hydroGroup.setLayout(new GridLayout(1, false));
hydroGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
hydroGroup.getHydroGroupClientArea().setLayout(new GridLayout(2, false));
Label label = new Label(hydroGroup.getHydroGroupClientArea(), SWT.NONE);
label.setText(Messages.LOG_LEVEL_CONSOLE_PREF_MESSAGE);
ccLogLevels=new CCombo(hydroGroup.getHydroGroupClientArea(), SWT.BORDER);
GridData gd_ccLogLevels = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_ccLogLevels.widthHint = 300;
if(OSValidator.isMac()){
gd_ccLogLevels.heightHint=20;
}
ccLogLevels.setLayoutData(gd_ccLogLevels);
ccLogLevels.setItems(Messages.COMBO_LOG_LEVELS.split(HASH_REGEX));
ccLogLevels.setText(logLevel);
}
示例15: createCCombo
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private CCombo createCCombo(Composite parent, String[] values, TabbedPropertySheetWidgetFactory factory, Control top) {
CCombo combo = factory.createCCombo(parent, SWT.NONE);
combo.setItems(values);
FormData data = new FormData();
data.left = new FormAttachment(0, 160);
data.right = new FormAttachment(100, 0);
if(top == null) {
data.top = new FormAttachment(0, VSPACE);
} else {
data.top = new FormAttachment(top, VSPACE);
}
combo.setLayoutData(data);
combo.addFocusListener(listener);
return combo;
}