本文整理汇总了Java中org.eclipse.swt.custom.CCombo.setText方法的典型用法代码示例。如果您正苦于以下问题:Java CCombo.setText方法的具体用法?Java CCombo.setText怎么用?Java CCombo.setText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.custom.CCombo
的用法示例。
在下文中一共展示了CCombo.setText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: insertControlContents
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
public void insertControlContents(Control control, String text,
int cursorPosition) {
CCombo combo = (CCombo) control;
String contents = combo.getText();
Point selection = combo.getSelection();
StringBuffer sb = new StringBuffer();
sb.append(contents.substring(0, selection.x));
sb.append(text);
if (selection.y < contents.length()) {
sb.append(contents.substring(selection.y, contents.length()));
}
combo.setText(sb.toString());
selection.x = selection.x + cursorPosition;
selection.y = selection.x;
combo.setSelection(selection);
}
示例3: 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 );
}
}
示例4: 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 );
}
}
示例5: 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 );
}
}
示例6: 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 );
}
}
示例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, "MemcachedOutputDialog.FailedToGetFields.DialogTitle" ),
BaseMessages.getString( PKG, "MemcachedOutputDialog.FailedToGetFields.DialogMessage" ), ke );
}
}
示例8: setInfos
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private void setInfos(CCombo combo){
try{
String field= combo.getText();
combo.removeAll();
RowMetaInterface r = transMeta.getPrevStepFields(stepname);
if (combo.equals(wFeatureNameField) || combo.equals(wFeatureDescField))
combo.add(Messages.getString("KMLFileOutputDialog.NoField.Text"));
if (r!=null){
r.getFieldNames();
for (int i=0;i<r.getFieldNames().length;i++){
combo.add(r.getFieldNames()[i]);
}
}
if(field!=null)
combo.setText(field);
}catch(KettleException ke){
new ErrorDialog(shell, Messages.getString("KMLFileOutputDialog.FailedToGetFields.DialogTitle"), Messages.getString("KMLFileOutputDialog.FailedToGetFields.DialogMessage"), ke); //$NON-NLS-1$ //$NON-NLS-2$
}
}
示例9: applyChanges
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private static final void applyChanges(Shell shell, List list, Control control, int position,
InsertTextInterface insertTextInterface) {
String extra = "${" + list.getSelection()[0] + "}";
if (insertTextInterface != null) {
insertTextInterface.insertText(extra, position);
} else {
if (control.isDisposed())
return;
if (list.getSelectionCount() <= 0)
return;
if (control instanceof Text) {
((Text)control).insert(extra);
} else if (control instanceof CCombo) {
CCombo combo = (CCombo)control;
combo.setText(extra); // We can't know the location of the cursor yet. All we can do is overwrite.
}
}
if (!shell.isDisposed())
shell.dispose();
if (!control.isDisposed()) control.setData(Boolean.FALSE);
}
示例10: 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$
}
}
示例11: appendBlankRowToTable
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private static void appendBlankRowToTable(Table table, TableItem item,
int index) {
item.setText(new String[] { String.format("%d", index), "Element name",
"Action keyword", "", "Selector value" });
TableEditor keywordChoiceEditor = new TableEditor(table);
CCombo keywordChoiceCombo = new CCombo(table, SWT.NONE);
keywordChoiceCombo.setText("Choose..");
for (String keyword : keywordTable.keySet()) {
keywordChoiceCombo.add(keyword);
}
// NOTE: none of options is initially selected
keywordChoiceEditor.grabHorizontal = true;
int keywordChoiceColumn = 2;
keywordChoiceCombo.setData("column", keywordChoiceColumn);
keywordChoiceCombo.setData("item", item);
keywordChoiceEditor.setEditor(keywordChoiceCombo, item,
keywordChoiceColumn);
keywordChoiceCombo.addModifyListener(new keywordChoiceListener());
TableEditor selectorChoiceEditor = new TableEditor(table);
CCombo selectorChoiceCombo = new CCombo(table, SWT.NONE);
selectorChoiceCombo.setText("Choose");
for (String locator : selectorFromSWD.values()) {
selectorChoiceCombo.add(locator);
}
// NOTE: none of options is initially selected
selectorChoiceEditor.grabHorizontal = true;
int selectorChoiceColumn = 3;
selectorChoiceCombo.setData("item", item);
selectorChoiceCombo.setData("column", selectorChoiceColumn);
selectorChoiceEditor.setEditor(selectorChoiceCombo, item,
selectorChoiceColumn);
selectorChoiceCombo.addModifyListener(new selectorChoiceListener());
return;
}
示例12: 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);
}
示例13: refreshCombo
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
/**
*
*
*/
private void refreshCombo(IElementParameter childParameter) {
if (childParameter == null) {
return;
}
CCombo combo = (CCombo) hashCurControls.get(childParameter.getName());
if (combo == null || combo.isDisposed()) {
return;
}
Object value = childParameter.getValue();
if (value instanceof String) {
String version = (String) value;
// String strValue = ""; //$NON-NLS-1$
// int nbInList = 0, nbMax = childParameter.getListItemsValue().length;
// while (strValue.equals(new String("")) && nbInList < nbMax) { //$NON-NLS-1$
// if (name.equals(childParameter.getListItemsValue()[nbInList])) {
// strValue = childParameter.getListItemsDisplayName()[nbInList];
// }
// nbInList++;
// }
String[] paramItems = getListToDisplay(childParameter);
String[] comboItems = combo.getItems();
if (!Arrays.equals(paramItems, comboItems)) {
combo.setItems(paramItems);
}
combo.setText(version);
// combo.setVisible(true);
}
}
示例14: createMultiValueExpressionButton
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private void createMultiValueExpressionButton( Composite parent,
final CCombo combo )
{
Listener listener = new Listener( ) {
public void handleEvent( Event event )
{
addBtn.setEnabled( false );
boolean change = false;
Expression expression = ExpressionButtonUtil.getExpression( combo );
if ( expression == null
|| expression.getStringExpression( ).trim( ).length( ) == 0 )
return;
if ( valueList.indexOf( expression ) < 0 )
{
valueList.add( expression );
change = true;
}
if ( change )
{
tableViewer.refresh( );
updateButtons( );
combo.setFocus( );
combo.setText( "" );
}
}
};
ExpressionButtonUtil.createExpressionButton( parent,
combo,
getCrosstabExpressionProvider( ),
designHandle,
listener );
}
示例15: applyChanges
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private static final void applyChanges(Shell shell, List list, Control control, int position,
InsertTextInterface insertTextInterface) {
String extra = "${" + list.getSelection()[0] + "}";
if (insertTextInterface != null) {
insertTextInterface.insertText(extra, position);
} else {
if (control.isDisposed())
return;
if (list.getSelectionCount() <= 0)
return;
if (control instanceof Text) {
((Text)control).insert(extra);
} else if (control instanceof CCombo) {
CCombo combo = (CCombo)control;
combo.setText(extra); // We can't know the location of the cursor yet. All we can do is overwrite.
} else if (control instanceof StyledTextComp) {
((StyledTextComp)control).insert(extra);
}
else if (control instanceof StyledText) {
((StyledText)control).insert(extra);
}
}
if (!shell.isDisposed())
shell.dispose();
if (!control.isDisposed()) control.setData(Boolean.FALSE);
}