本文整理汇总了Java中org.eclipse.swt.custom.CCombo.addModifyListener方法的典型用法代码示例。如果您正苦于以下问题:Java CCombo.addModifyListener方法的具体用法?Java CCombo.addModifyListener怎么用?Java CCombo.addModifyListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.custom.CCombo
的用法示例。
在下文中一共展示了CCombo.addModifyListener方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: createDialogArea
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
protected Control createDialogArea(Composite parent) {
// create composite
Composite composite = (Composite) super.createDialogArea(parent);
// create message
if (message != null) {
Label label = new Label(composite, SWT.WRAP);
label.setText(message);
GridData data = new GridData(GridData.GRAB_HORIZONTAL
| GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
| GridData.VERTICAL_ALIGN_CENTER);
data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
label.setLayoutData(data);
label.setFont(parent.getFont());
}
combo = new CCombo(composite, getInputComboStyle());
combo.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
| GridData.HORIZONTAL_ALIGN_FILL));
combo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
validateInput();
}
});
errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP);
errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
| GridData.HORIZONTAL_ALIGN_FILL));
errorMessageText.setBackground(errorMessageText.getDisplay()
.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
errorMessageText.setForeground(errorMessageText.getDisplay()
.getSystemColor(SWT.COLOR_RED));
// Set the error message text
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292
setErrorMessage(errorMessage);
applyDialogFont(composite);
return composite;
}
示例4: createLineCombo
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private CCombo createLineCombo(ModifyListener lsMod, String lableText,
Control prevControl)
{
// Value line
Label lable = new Label(shell, SWT.RIGHT);
lable.setText(lableText); //$NON-NLS-1$
props.setLook(lable);
FormData lableFormData = new FormData();
lableFormData.left = new FormAttachment(0, 0);
lableFormData.right = new FormAttachment(props.getMiddlePct(),
-Const.MARGIN);
// In case it is the first control
if (prevControl != null)
lableFormData.top = new FormAttachment(prevControl, Const.MARGIN);
else
lableFormData.top = new FormAttachment(0, Const.MARGIN);
lable.setLayoutData(lableFormData);
CCombo control = new CCombo(shell, SWT.BORDER);
props.setLook(control);
control.addModifyListener(lsMod);
FormData widgetFormData = new FormData();
widgetFormData.left = new FormAttachment(props.getMiddlePct(), 0);
// In case it is the first control
if (prevControl != null)
widgetFormData.top = new FormAttachment(prevControl, Const.MARGIN);
else
widgetFormData.top = new FormAttachment(0, Const.MARGIN);
widgetFormData.right = new FormAttachment(100, 0);
control.setLayoutData(widgetFormData);
return control;
}
示例5: addStandardSelect
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
protected CCombo addStandardSelect(String labelMessageKey, Control prevControl, String[] choices) {
int vertPad = verticalPadding;
addStandardLabel(labelMessageKey, prevControl);
verticalPadding = vertPad;
CCombo combo = new CCombo(shell, SWT.BORDER);
combo.setItems(choices);
combo.addModifyListener(lsMod);
combo.setLayoutData(standardInputSpacing(prevControl));
return combo;
}
示例6: createJoinTypeWidget
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
/**
* Create widgets for join type selection
* @param lsMod
*/
private void createJoinTypeWidget(final ModifyListener lsMod) {
Label joinTypeLabel=new Label(shell, SWT.LEFT);
joinTypeLabel.setText(BaseMessages.getString(PKG, "MultiMergeJoinDialog.Type.Label")); //$NON-NLS-1$
props.setLook(joinTypeLabel);
FormData fdlType=new FormData();
fdlType.left = new FormAttachment(0, 0);
fdlType.right= new FormAttachment(15, -margin);
if(wInputStepArray.length > 0)
{
fdlType.top = new FormAttachment(wInputStepArray[wInputStepArray.length-1], margin);
}
else
{
fdlType.top = new FormAttachment(wStepname, margin);
}
joinTypeLabel.setLayoutData(fdlType);
joinTypeCombo=new CCombo(shell, SWT.BORDER );
props.setLook(joinTypeCombo);
joinTypeCombo.setItems(MultiMergeJoinMeta.join_types);
joinTypeCombo.addModifyListener(lsMod);
FormData fdType=new FormData();
if(wInputStepArray.length >0)
{
fdType.top = new FormAttachment(wInputStepArray[wInputStepArray.length-1], margin);
}
else
{
fdType.top = new FormAttachment(wStepname, margin);
}
fdType.left = new FormAttachment(15, 0);
fdType.right= new FormAttachment(35, 0);
joinTypeCombo.setLayoutData(fdType);
}
示例7: addStandardSelect
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
protected CCombo addStandardSelect(String labelMessageKey, Control prevControl, String[] choices) {
int vertPad = verticalPadding;
Label label = addStandardLabel(labelMessageKey, prevControl);
verticalPadding = vertPad;
CCombo combo = new CCombo(shell, SWT.BORDER);
combo.setItems(choices);
combo.addModifyListener(lsMod);
combo.setLayoutData(standardInputSpacing(prevControl, label));
return combo;
}
示例8: appendRowToTable
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private static void appendRowToTable(Table table, List<String> stepIds) {
TableItem[] tableItems = table.getItems();
int cnt = 0;
for (String stepId : stepIds) {
// get element data
TableItem tableItem = tableItems[cnt];
Map<String, String> elementData = testData.get(stepId);
String selectorChoice = selectorFromSWD
.get(elementData.get("ElementSelectedBy"));
String selectorValue = elementData
.get(elementData.get("ElementSelectedBy"));
// Append row into the TableEditor
tableItem.setText(new String[] { elementData.get("ElementStepNumber"),
elementData.get("ElementCodeName"), String.format("Action %d", cnt),
selectorChoice, selectorValue });
// some columns need to be converted to selects
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", tableItem);
keywordChoiceEditor.setEditor(keywordChoiceCombo, tableItem,
keywordChoiceColumn);
keywordChoiceCombo.addModifyListener(new keywordChoiceListener());
TableEditor selectorChoiceEditor = new TableEditor(table);
CCombo selectorChoiceCombo = new CCombo(table, SWT.NONE);
for (String locator : selectorFromSWD.values()) {
selectorChoiceCombo.add(locator);
}
int currentSelector = new ArrayList<String>(selectorFromSWD.values())
.indexOf(selectorFromSWD.get(elementData.get("ElementSelectedBy")));
selectorChoiceCombo.select(currentSelector);
selectorChoiceEditor.grabHorizontal = true;
int selectorChoiceColumn = 3;
selectorChoiceCombo.setData("item", tableItem);
selectorChoiceCombo.setData("column", selectorChoiceColumn);
selectorChoiceEditor.setEditor(selectorChoiceCombo, tableItem,
selectorChoiceColumn);
selectorChoiceCombo.addModifyListener(new selectorChoiceListener());
cnt = cnt + 1;
}
return;
}
示例9: initControl
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
@Override
protected void initControl() {
isReadOnly = (controlStyle & SWT.READ_ONLY) != 0;
// BUG in SWT: clear READ_ONLY bit since this does block the ProgressMonitorDialog
combo = new CCombo(parent, controlStyle | SWT.FLAT | SWT.SINGLE | SWT.BORDER) {
@Override
protected void checkSubclass() {
}
//
// public void setSelection(Point selection) {
// deselectAll();
// }
};
// combo = new CCombo(parent, controlStyle & ~SWT.READ_ONLY);
FontData[] fD = combo.getFont().getFontData();
fD[0].setHeight(DEFAULT_FONT_SIZE);
// combo.setFont(new Font(display,fD[0]));
combo.setFont(Fonts.createFont(fD[0]));
this.setControl(combo);
combo.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
setWidth(combo.computeSize(SWT.DEFAULT, SWT.DEFAULT).x);
}
});
combo.setEditable(false);
combo.setBackground(Colors.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
combo.setListVisible(false);
// if (isReadOnly) {
// logger.debug("combo is read only!");
// combo.setBackground(Colors.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
//
//
//
// combo.addKeyListener(new KeyListener() {
//
// @Override
// public void keyPressed(KeyEvent e) {
//
// e.doit=false;
// }
//
// @Override
// public void keyReleased(KeyEvent e) {
//
// e.doit=false;
// }
// });
// }
}
示例10: ComboVar
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
public ComboVar(VariableSpace space, Composite composite, int flags, String toolTipText,
GetCaretPositionInterface getCaretPositionInterface, InsertTextInterface insertTextInterface) {
super(composite, SWT.NONE);
this.toolTipText = toolTipText;
this.getCaretPositionInterface = getCaretPositionInterface;
this.insertTextInterface = insertTextInterface;
this.variables = space;
//props.setLook(this);
// int margin = Const.MARGIN;
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = 0;
formLayout.marginHeight = 0;
formLayout.marginTop = 0;
formLayout.marginBottom = 0;
this.setLayout(formLayout);
// add a text field on it...
wCombo = new CCombo(this, flags);
controlDecoration = new ControlDecoration(wCombo, SWT.TOP | SWT.RIGHT);
Image image = GUIResource.getInstance().getImageVariable();
controlDecoration.setImage(image);
controlDecoration.setDescriptionText(Messages.getString("TextVar.tooltip.InsertVariable"));
//props.setLook(wText);
wCombo.addModifyListener(getModifyListenerTooltipText(wCombo));
// SelectionAdapter lsVar = null;
// VariableButtonListenerFactory.getSelectionAdapter(this, wText, getCaretPositionInterface,
// insertTextInterface, variables);
//wText.addKeyListener(getControlSpaceKeyListener(variables, wText, lsVar, getCaretPositionInterface,
// insertTextInterface));
controlSpaceKeyAdapter = new ControlSpaceKeyAdapter(variables, wCombo,getCaretPositionInterface, insertTextInterface);
wCombo.addKeyListener(controlSpaceKeyAdapter);
FormData fdText = new FormData();
fdText.top = new FormAttachment(0, 0);
fdText.left = new FormAttachment(0, 0);
fdText.right = new FormAttachment(100, -image.getBounds().width);
wCombo.setLayoutData(fdText);
}
示例11: editCombo
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private void editCombo(TableItem row, int rownr, int colnr)
{
before_edit = getItemText(row);
field_changed = false;
ColumnInfo colinfo = columns[colnr-1];
if (columns[colnr-1].isReadOnly() && columns[colnr-1].getSelectionAdapter()!=null)
{
return;
}
combo = new CCombo(table, colinfo.isReadOnly()?SWT.READ_ONLY:SWT.NONE );
props.setLook(combo, Props.WIDGET_STYLE_TABLE);
combo.addTraverseListener(lsTraverse);
combo.addModifyListener(lsModCombo);
combo.addFocusListener(lsFocusCombo);
String opt[] = colinfo.getComboValues();
if (colinfo.getComboValuesSelectionListener()!=null) {
opt = colinfo.getComboValuesSelectionListener().getComboValues(row, rownr, colnr);
}
for (int i=0;i<opt.length;i++) combo.add(opt[i]);
combo.setText(row.getText(colnr));
if (lsMod!=null) combo.addModifyListener(lsMod);
combo.addModifyListener(lsUndo);
String tooltip = colinfo.getToolTip();
if (tooltip!=null) combo.setToolTipText(tooltip); else combo.setToolTipText("");
combo.setVisible(true);
combo.addKeyListener(lsKeyCombo);
if (columns[colnr-1].getSelectionAdapter()!=null)
{
combo.addSelectionListener(columns[colnr-1].getSelectionAdapter());
}
editor.horizontalAlignment = SWT.LEFT;
editor.layout();
// Open the text editor in the correct column of the selected row.
editor.setEditor (combo, row, colnr);
combo.setFocus();
combo.layout();
}
示例12: placeComponents
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private void placeComponents( )
{
GridLayout glNumberAdvanced = new GridLayout( );
glNumberAdvanced.verticalSpacing = 5;
glNumberAdvanced.numColumns = 2;
glNumberAdvanced.marginHeight = 2;
glNumberAdvanced.marginWidth = 2;
GridData gdGRPNumberAdvanced = new GridData( GridData.FILL_BOTH );
this.setLayoutData( gdGRPNumberAdvanced );
this.setLayout( glNumberAdvanced );
lblAdvMultiplier = new Label( this, SWT.NONE );
GridData gdLBLAdvMultiplier = new GridData( );
lblAdvMultiplier.setLayoutData( gdLBLAdvMultiplier );
lblAdvMultiplier.setText( Messages.getString( "FormatSpecifierComposite.Lbl.Multiplier" ) ); //$NON-NLS-1$
txtAdvMultiplier = new LocalizedNumberEditorComposite( this,
SWT.BORDER | SWT.SINGLE );
new TextNumberEditorAssistField( txtAdvMultiplier.getTextControl( ), null );
GridData gdTXTAdvMultiplier = new GridData( GridData.FILL_HORIZONTAL );
txtAdvMultiplier.setLayoutData( gdTXTAdvMultiplier );
txtAdvMultiplier.addModifyListener( this );
lblNumberPattern = new Label( this, SWT.NONE );
GridData gdLBLNumberPattern = new GridData( );
lblNumberPattern.setLayoutData( gdLBLNumberPattern );
lblNumberPattern.setText( Messages.getString( "FormatSpecifierComposite.Lbl.NumberPattern" ) ); //$NON-NLS-1$
txtNumberPattern = new CCombo( this, SWT.BORDER | SWT.SINGLE );
GridData gdTXTNumberPattern = new GridData( GridData.FILL_HORIZONTAL );
txtNumberPattern.setLayoutData( gdTXTNumberPattern );
txtNumberPattern.addModifyListener( this );
// set sample number patterns
txtNumberPattern.setItems( new String[]{
"##.##%", //$NON-NLS-1$
"##.###", //$NON-NLS-1$
"00.###", //$NON-NLS-1$
"##,###.00", //$NON-NLS-1$
"0.00'K'", //$NON-NLS-1$
"##0.00 \u00A4", //$NON-NLS-1$
"###0.000\u2030" //$NON-NLS-1$
} );
txtNumberPattern.setVisibleItemCount( txtNumberPattern.getItemCount( ) );
txtNumberPattern.addSelectionListener( new SelectionAdapter( ) {
@Override
public void widgetSelected( SelectionEvent e )
{
bEnableEvents = false;
if ( !( formatspecifier instanceof JavaNumberFormatSpecifier ) )
{
formatspecifier = JavaNumberFormatSpecifierImpl.create( "" ); //$NON-NLS-1$
}
( (JavaNumberFormatSpecifier) formatspecifier ).setPattern( ChartUIUtil.getText( txtNumberPattern ) );
bEnableEvents = true;
updatePreview( );
}
} );
}
示例13: ComboVar
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
public ComboVar(VariableSpace space, Composite composite, int flags, String toolTipText,
GetCaretPositionInterface getCaretPositionInterface, InsertTextInterface insertTextInterface) {
super(composite, SWT.NONE);
this.toolTipText = toolTipText;
this.getCaretPositionInterface = getCaretPositionInterface;
this.insertTextInterface = insertTextInterface;
this.variables = space;
//props.setLook(this);
// int margin = Const.MARGIN;
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = 0;
formLayout.marginHeight = 0;
formLayout.marginTop = 0;
formLayout.marginBottom = 0;
this.setLayout(formLayout);
// add a text field on it...
wCombo = new CCombo(this, flags);
controlDecoration = new ControlDecoration(wCombo, SWT.TOP | SWT.RIGHT);
Image image = GUIResource.getInstance().getImageVariable();
controlDecoration.setImage(image);
controlDecoration.setDescriptionText(BaseMessages.getString(PKG, "TextVar.tooltip.InsertVariable"));
//props.setLook(wText);
wCombo.addModifyListener(getModifyListenerTooltipText(wCombo));
// SelectionAdapter lsVar = null;
// VariableButtonListenerFactory.getSelectionAdapter(this, wText, getCaretPositionInterface,
// insertTextInterface, variables);
//wText.addKeyListener(getControlSpaceKeyListener(variables, wText, lsVar, getCaretPositionInterface,
// insertTextInterface));
controlSpaceKeyAdapter = new ControlSpaceKeyAdapter(variables, wCombo,getCaretPositionInterface, insertTextInterface);
wCombo.addKeyListener(controlSpaceKeyAdapter);
FormData fdText = new FormData();
fdText.top = new FormAttachment(0, 0);
fdText.left = new FormAttachment(0, 0);
fdText.right = new FormAttachment(100, -image.getBounds().width);
wCombo.setLayoutData(fdText);
}
示例14: editCombo
import org.eclipse.swt.custom.CCombo; //导入方法依赖的package包/类
private void editCombo(TableItem row, int rownr, int colnr)
{
before_edit = getItemText(row);
field_changed = false;
ColumnInfo colinfo = columns[colnr-1];
if (colinfo.isReadOnly() && colinfo.getSelectionAdapter()!=null)
{
return;
}
if (colinfo.getDisabledListener()!=null) {
boolean disabled = colinfo.getDisabledListener().isFieldDisabled(rownr);
if (disabled) return;
}
combo = new CCombo(table, colinfo.isReadOnly()?SWT.READ_ONLY:SWT.NONE );
props.setLook(combo, Props.WIDGET_STYLE_TABLE);
combo.addTraverseListener(lsTraverse);
combo.addModifyListener(lsModCombo);
combo.addFocusListener(lsFocusCombo);
String opt[] = getComboValues(row, colinfo);
if (colinfo.getComboValuesSelectionListener()!=null) {
opt = colinfo.getComboValuesSelectionListener().getComboValues(row, rownr, colnr);
}
for (int i=0;i<opt.length;i++) combo.add(opt[i]);
combo.setText(row.getText(colnr));
if (lsMod!=null) combo.addModifyListener(lsMod);
combo.addModifyListener(lsUndo);
String tooltip = colinfo.getToolTip();
if (tooltip!=null) combo.setToolTipText(tooltip); else combo.setToolTipText("");
combo.setVisible(true);
combo.addKeyListener(lsKeyCombo);
if (colinfo.getSelectionAdapter()!=null)
{
combo.addSelectionListener(columns[colnr-1].getSelectionAdapter());
}
editor.horizontalAlignment = SWT.LEFT;
editor.layout();
// Open the text editor in the correct column of the selected row.
editor.setEditor (combo, row, colnr);
combo.setFocus();
combo.layout();
}