本文整理匯總了Java中org.eclipse.swt.widgets.Combo.addModifyListener方法的典型用法代碼示例。如果您正苦於以下問題:Java Combo.addModifyListener方法的具體用法?Java Combo.addModifyListener怎麽用?Java Combo.addModifyListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.Combo
的用法示例。
在下文中一共展示了Combo.addModifyListener方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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();
}
});
}
示例2: createNgCommandComponent
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private void createNgCommandComponent(Composite parent) {
Group group = new Group(parent, SWT.NONE);
String groupName = AngularCLIMessages.AngularCLILaunchTabGroup_MainTab_command;
group.setText(groupName);
GridLayout layout = new GridLayout();
layout.numColumns = 1;
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
group.setLayout(layout);
group.setLayoutData(gridData);
commandsCommbo = new Combo(group, SWT.BORDER | SWT.H_SCROLL);
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
commandsCommbo.setLayoutData(data);
String[] items = new String[NgCommand.values().length];
for (int i = 0; i < items.length; i++) {
items[i] = NgCommand.values()[i].getAliases()[0];
}
commandsCommbo.setItems(items);
commandsCommbo.addModifyListener(fListener);
}
示例3: createWidgets
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
@Override
protected void createWidgets(String text, String toolTip, String initialValue) {
lbl = new Label(this, SWT.NONE);
lbl.setText(text.concat(":"));
lbl.setToolTipText(toolTip);
comboBox = new Combo(this, SWT.READ_ONLY);
comboBox.setToolTipText(toolTip);
errorIcon = new Label(this, SWT.NONE);
errorIcon.setImage(Icon.getImage(Icon.EXCLAMATION_RED));
errorIcon.setVisible(false);
comboBox.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
String value = comboBox.getText();
if (value != getValue()) {
setValue(comboBox.getText(), true);
}
}
});
}
示例4: createDialogArea
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/**
* Create contents of the dialog.
* @param parent
*/
@Override protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
container.setLayout(new GridLayout(2, false));
label = new Label(container, 0);
label.setText(labelTxt);
combo = new Combo(container, SWT.READ_ONLY | SWT.DROP_DOWN);
combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
combo.addModifyListener(new ModifyListener() {
@Override public void modifyText(ModifyEvent e) {
updateVals();
}
});
combo.setItems(items);
combo.select(0);
updateVals();
container.pack();
return container;
}
示例5: createType_trigger_combo
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/**
* This method initializes type_trigger_combo
*
*/
private void createType_trigger_combo() {
GridData gridData2 = new GridData();
gridData2.horizontalAlignment = GridData.FILL;
gridData2.verticalAlignment = GridData.CENTER;
gridData2.grabExcessHorizontalSpace = true;
type_trigger_combo = new Combo(commun_trigger, SWT.READ_ONLY);
type_trigger_combo.setItems(customTriggers);
type_trigger_combo
.addModifyListener(new org.eclipse.swt.events.ModifyListener() {
public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
int index = type_trigger_combo.getSelectionIndex();
if (index == -1) {
type_trigger_combo.select(0);
} else if (index != last_index && custom_triggers != null) {
help_label.setText(custom_triggers[index].getHelp());
stackLayout.topControl = custom_triggers[index];
custom_trigger.layout();
last_index = index;
if (index == 5) { // NoWait case
timeout_label.setVisible(false);
timeout_spin.setVisible(false);
} else {
timeout_label.setVisible(true);
timeout_spin.setVisible(true);
}
}
}
});
type_trigger_combo.setLayoutData(gridData2);
}
示例6: createContents
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
@Override
protected Control createContents(Composite parent) {
Composite panel = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(2, false);
layout.marginHeight = 0;
layout.marginWidth = 0;
panel.setLayout(layout);
btnForceUnixNewlines = new Button(panel, SWT.CHECK);
btnForceUnixNewlines.setText(Messages.ProjectProperties_force_unix_newlines);
btnForceUnixNewlines.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false, 2, 1));
btnForceUnixNewlines.setSelection(prefs.getBoolean(PROJ_PREF.FORCE_UNIX_NEWLINES, true));
Label label = new Label(panel, SWT.NONE);
label.setText(Messages.projectProperties_timezone_for_all_db_connections);
cmbTimezone = new Combo(panel, SWT.BORDER | SWT.DROP_DOWN);
cmbTimezone.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
cmbTimezone.setItems(UIConsts.TIME_ZONES.toArray(new String[UIConsts.TIME_ZONES.size()]));
String tz = prefs.get(PROJ_PREF.TIMEZONE, ApgdiffConsts.UTC);
cmbTimezone.setText(tz);
cmbTimezone.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
checkSwitchWarnLbl();
}
});
lblWarn = new CLabel(panel, SWT.NONE);
lblWarn.setImage(Activator.getEclipseImage(ISharedImages.IMG_OBJS_WARN_TSK));
lblWarn.setText(Messages.ProjectProperties_change_projprefs_warn);
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, false, false, 2, 1);
gd.exclude = true;
lblWarn.setLayoutData(gd);
lblWarn.setVisible(false);
return panel;
}
示例7: BlockCipherConfigComposite
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/**
* Create the composite.
*
* @param parent
* @param style
*/
public BlockCipherConfigComposite(Composite parent, int style) {
super(parent, style);
setLayout(new GridLayout(2, false));
Label encryptionAlgLabel = new Label(this, SWT.NONE);
encryptionAlgLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
encryptionAlgLabel.setText("Encryption Algorithm");
encAlgSelector = new Combo(this, SWT.READ_ONLY);
encAlgSelector.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
encAlgSelector.addModifyListener(new ValidateModifyListener());
Label encModeLabel = new Label(this, SWT.NONE);
encModeLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
encModeLabel.setText("Encryption Mode");
encModeSelector = new Combo(this, SWT.READ_ONLY);
encModeSelector.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
encModeSelector.addModifyListener(new ValidateModifyListener());
Label encPadLabel = new Label(this, SWT.NONE);
encPadLabel.setText("Encryption Padding");
encPadSelector = new Combo(this, SWT.READ_ONLY);
encPadSelector.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
hkdfLabel = new Label(this, SWT.NONE);
hkdfLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
hkdfLabel.setText("HKDF Algorithm");
hkdfSelector = new Combo(this, SWT.READ_ONLY);
hkdfSelector.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
encPadSelector.addModifyListener(new ValidateModifyListener());
fillIn();
}
示例8: removeDecoration
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
public static void removeDecoration(final Widget widget, final String modifyListenerWidgetDataKey) {
if (hasDecoration(widget)) {
ModifyListener modifyListener = null;
if (modifyListenerWidgetDataKey != null) {
modifyListener = (ModifyListener) widget.getData(modifyListenerWidgetDataKey);
}
if (widget instanceof Text) {
final Text text = (Text) widget;
if (modifyListener != null) {
text.removeModifyListener(modifyListener);
}
text.setText(""); //$NON-NLS-1$
if (modifyListener != null) {
text.addModifyListener(modifyListener);
}
} else {
final Combo combo = (Combo) widget;
if (modifyListener != null) {
combo.removeModifyListener(modifyListener);
}
combo.setText(""); //$NON-NLS-1$
if (modifyListener != null) {
combo.addModifyListener(modifyListener);
}
}
setHasDecoration(widget, false);
}
}
示例9: createControl
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
@Override
public void createControl(final Composite parent) {
final Composite composite = new Composite(parent, SWT.NULL);
final GridLayout layout = new GridLayout();
layout.numColumns = 2;
composite.setLayout(layout);
final Label label = new Label(composite, SWT.NULL);
label.setText(ResourceString.getResourceString("label.database"));
databaseCombo = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
final GridData dbData = new GridData(GridData.FILL_HORIZONTAL);
dbData.widthHint = 200;
databaseCombo.setLayoutData(dbData);
databaseCombo.setVisibleItemCount(10);
for (final String db : DBManagerFactory.getAllDBList()) {
databaseCombo.add(db);
}
databaseCombo.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
validatePage();
}
});
databaseCombo.setFocus();
validatePage();
setControl(composite);
}
示例10: addComboListener
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
public static void addComboListener(final Combo combo, final AbstractDialog dialog, final boolean imeOn) {
addFocusListener(combo, imeOn);
if (dialog != null) {
combo.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
dialog.validate();
}
});
}
}
示例11: addComboListener
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
public static void addComboListener(final Combo combo,
final AbstractDialog dialog, final boolean imeOn) {
addFocusListener(combo, imeOn);
if (dialog != null) {
combo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
dialog.validate();
}
});
}
}
示例12: SecurityConfigComposite
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/**
* Create the composite.
*
* @param parent
* @param style
*/
public SecurityConfigComposite(Composite parent, int style) {
super(parent, style);
setLayout(new GridLayout(2, false));
Label macTypeLabel = new Label(this, SWT.NONE);
macTypeLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
macTypeLabel.setText("Mac Type");
macTypeSelector = new Combo(this, SWT.READ_ONLY);
macTypeSelector.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
macTypeSelector.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent arg0) {
fillInMacAlg();
}
});
Label macAlgLabel = new Label(this, SWT.NONE);
macAlgLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
macAlgLabel.setText("Mac Algorithm");
macAlgSelector = new Combo(this, SWT.READ_ONLY);
macAlgSelector.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
macAlgSelector.addModifyListener(new ValidateModifyListener());
kdfLabel = new Label(this, SWT.NONE);
kdfLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
kdfLabel.setText("KDF Hash");
kdfCombo = new Combo(this, SWT.READ_ONLY);
kdfCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
kdfCombo.addModifyListener(new ValidateModifyListener());
compressionLabel = new Label(this, SWT.NONE);
compressionLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
compressionLabel.setText("Compression");
compressionSelector = new Combo(this, SWT.READ_ONLY);
compressionSelector.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
errorLabel = new Label(this, SWT.NONE);
errorLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
errorLabel.setText("");
fillIn();
}
示例13: focusLost
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
@Override
public void focusLost(final FocusEvent e) {
addDecoration(workItemField, e.widget, modifyListenerWidgetDataKey);
/*
* TODO: this block should probably live somewhere else, as it's only
* needed for FieldControl's Combo
*/
if (e.widget instanceof Combo) {
final Combo combo = (Combo) e.widget;
final String comboText = combo.getText().trim();
final String[] comboItems = combo.getItems();
for (int i = 0; i < comboItems.length; i++) {
/*
* I18N: need to use a java.text.Collator with a specified
* Locale. Set the Collator's strenth to SECONDARY (or possibly
* PRIMARY) since the desired semantic is a case-insensitive
* comparison.
*/
if (comboItems[i].equalsIgnoreCase(comboText)) {
ModifyListener modifyListener = null;
if (modifyListenerWidgetDataKey != null) {
modifyListener = (ModifyListener) combo.getData(modifyListenerWidgetDataKey);
}
if (modifyListener != null) {
combo.removeModifyListener(modifyListener);
}
combo.setText(comboItems[i]);
if (modifyListener != null) {
combo.addModifyListener(modifyListener);
}
break;
}
}
}
}
示例14: addDecoration
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
public static void addDecoration(
final Field workItemField,
final Widget widget,
final String modifyListenerWidgetDataKey) {
if (needToAddDecoration(workItemField, widget)) {
ModifyListener modifyListener = null;
if (modifyListenerWidgetDataKey != null) {
modifyListener = (ModifyListener) widget.getData(modifyListenerWidgetDataKey);
}
if (widget instanceof Text) {
final Text text = (Text) widget;
if (modifyListener != null) {
text.removeModifyListener(modifyListener);
}
text.setText(DECORATION_TEXT);
text.setSelection(new Point(0, DECORATION_TEXT.length()));
if (modifyListener != null) {
text.addModifyListener(modifyListener);
}
} else {
final Combo combo = (Combo) widget;
if (modifyListener != null) {
combo.removeModifyListener(modifyListener);
}
combo.setText(DECORATION_TEXT);
combo.setSelection(new Point(0, DECORATION_TEXT.length()));
if (modifyListener != null) {
combo.addModifyListener(modifyListener);
}
}
setHasDecoration(widget, true);
}
}
示例15: AbstractComboControlValidator
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/**
* Creates a new {@link AbstractComboControlValidator} that will validate
* the specified {@link Combo} subject. This constructor attaches a
* {@link ModifyListener} to the subject. This listener will be removed in
* the {@link #dispose()} method. <b>Important:</b> this constructor does
* not perform initial validation of the subject. The subclass <b>must</b>
* call the {@link #validate()} method before the subclass constructor
* finishes.
*
* @param subject
* the {@link Combo} control subject to validate (must not be
* <code>null</code>)
*/
protected AbstractComboControlValidator(final Combo subject) {
super(subject);
modifyListener = new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
AbstractComboControlValidator.this.onTextModified(e);
}
};
subject.addModifyListener(modifyListener);
}