本文整理汇总了Java中org.eclipse.swt.custom.CCombo.getText方法的典型用法代码示例。如果您正苦于以下问题:Java CCombo.getText方法的具体用法?Java CCombo.getText怎么用?Java CCombo.getText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.custom.CCombo
的用法示例。
在下文中一共展示了CCombo.getText方法的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: getInsertionBounds
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
public Rectangle getInsertionBounds(Control control) {
// This doesn't take horizontal scrolling into affect.
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=204599
CCombo combo = (CCombo) control;
int position = combo.getSelection().y;
String contents = combo.getText();
GC gc = new GC(combo);
gc.setFont(combo.getFont());
Point extent = gc.textExtent(contents.substring(0, Math.min(position,
contents.length())));
gc.dispose();
if (COMPUTE_TEXT_USING_CLIENTAREA) {
return new Rectangle(combo.getClientArea().x + extent.x, combo
.getClientArea().y, 1, combo.getClientArea().height);
}
return new Rectangle(extent.x, 0, 1, combo.getSize().y);
}
示例4: keyPressed
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
public void keyPressed(KeyEvent e) {
if (e.keyCode == UICoreConstant.UMLSECTION_CONSTANTS__KEYCODE_ENTER
|| e.keyCode == UICoreConstant.UMLSECTION_CONSTANTS__KEYCODE_ENTER_SECOND) {
CCombo combo = (CCombo) e.getSource();
String text = combo.getText();
try {
final int value = new Integer(text).intValue();
final Property property = this.property;
if (value > 0) {
DomainUtil.run(new TransactionalAction() {
@Override
public void doExecute() {
property.setLower(value);
property.setUpper(value);
}
});
}
} catch (Exception e2) {
// TODO: handle exception
}
}
}
示例5: focusLost
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
public void focusLost(FocusEvent e) {
CCombo combo = (CCombo) e.getSource();
String text = combo.getText();
try {
final int value = new Integer(text).intValue();
final Property property = this.property;
if (value > 0) {
DomainUtil.run(new TransactionalAction() {
@Override
public void doExecute() {
property.setLower(value);
property.setUpper(value);
}
});
}
} catch (Exception e2) {
// TODO: handle exception
}
}
示例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: doSetFocus
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
@Override
public void doSetFocus() {
final CCombo combo = (CCombo)getControl();
if (!combo.isDisposed()) {
String text = combo.getText();
if (text.length() == 0 && CommonUtils.isWSCocoa()) {
combo.getDisplay().timerExec(1000, new Runnable() {
@Override
public void run() {
focusIt(combo);
}
});
} else {
focusIt(combo);
}
}
}
示例8: createComboCommand
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
/**
* DOC nrousseau Comment method "createComboCommand".
*
* @param source
* @return
*/
private PropertyChangeCommand createComboCommand(CCombo combo) {
String paramName = (String) combo.getData(PARAMETER_NAME);
IElementParameter param = elem.getElementParameter(paramName);
String value = combo.getText();
// for (int j = 0; j < param.getListItemsValue().length; j++) {
// if (combo.getText().equals(param.getListItemsDisplayName()[j])) {
// value = (String) param.getListItemsValue()[j];
// }
// }
if (value.equals(param.getValue())) {
return null;
}
return new PropertyChangeCommand(elem, paramName, value);
}
示例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, "HazelcastInputDialog.FailedToGetFields.DialogTitle" ),
BaseMessages.getString( PKG, "HazelcastInputDialog.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, "HazelcastOutputDialog.FailedToGetFields.DialogTitle" ),
BaseMessages.getString( PKG, "HazelcastOutputDialog.FailedToGetFields.DialogMessage" ), ke );
}
}
示例11: 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 );
}
}
示例12: 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 );
}
}
示例13: 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$
}
}
示例14: modify
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
public boolean modify( Object data, String property, Object value )
throws NameException, SemanticException
{
int index = Arrays.asList( columnNames ).indexOf( property );
String key = columnKeys[index];
String strValue;
if ( value instanceof Integer )
{
int intValue = ( (Integer) value ).intValue( );
if ( intValue == -1 )
{
CCombo combo = (CCombo) editors[index].getControl( );
strValue = combo.getText( );
}
else
{
String[] choices = modelAdapter.getChoiceSet( input.get( 0 ),
columnKeys[index] );
strValue = choices[intValue];
}
}
else
strValue = (String) value;
return modelAdapter.setStringValue( input.get( 0 ), data, key, strValue );
}
示例15: 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$
}
}