本文整理匯總了Java中org.eclipse.swt.widgets.Combo.setText方法的典型用法代碼示例。如果您正苦於以下問題:Java Combo.setText方法的具體用法?Java Combo.setText怎麽用?Java Combo.setText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.Combo
的用法示例。
在下文中一共展示了Combo.setText方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createDialogArea
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
protected Control createDialogArea(Composite parent) {
Composite area = (Composite) super.createDialogArea(parent);
Composite container = new Composite(area, SWT.NONE);
RowLayout layout = new RowLayout(SWT.HORIZONTAL);
container.setLayout(layout);
// container.setLayoutData(new GridData(GridData.FILL_BOTH));
// TitleArea中的Title
setTitle("屬性文件更新");
// TitleArea中的Message
setMessage("輸入正確的url地址,以更新文件。\n可提示的屬性數量會根據當前項目存在的jar包,對已有屬性增加或者刪除!");
Label label = new Label(container, SWT.NONE);
label.setText("項目URL: ");
combo = new Combo(container, SWT.DROP_DOWN);
String[] items = new String[getUrlMap().size()];
getUrlMap().values().toArray(items);
combo.setItems(items);
String url = getPreferedUrl(projectName);
combo.setText(url);
combo.setLayoutData(new RowData(400, 30));
return area;
}
示例2: addVersionSection
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private void addVersionSection(Composite parent) {
Composite composite = createDefaultComposite(parent);
// Label for owner field
Label ownerLabel = new Label(composite, SWT.NONE);
ownerLabel.setText(LEGACY_VERSION_TITLE);
// Owner text field
legacyVersionCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
GridData gd = new GridData();
gd.widthHint = convertWidthInCharsToPixels(COMBO_FIELD_WIDTH);
legacyVersionCombo.setLayoutData(gd);
// Populate owner text field
LegacyVersion legacyVersion = LegacyManager.getInstance().getVersion(getProject());
legacyVersionCombo.setItems(LegacyVersion.names());
legacyVersionCombo.setText(legacyVersion.name());
}
示例3: addCombovalues
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private void addCombovalues(Combo combo, String paramType) {
if(!PrimitiveType.isPrimitiveSig(paramType)) {
String sel = combo.getText();
combo.removeAll();
combo.add("null");
IType owner = (IType) method.getParent();
try {
IField[] fields = owner.getFields();
for(IField f : fields)
if(Flags.isStatic(f.getFlags()) && f.getTypeSignature().equals(paramType))
combo.add(f.getElementName());
} catch (JavaModelException e1) {
e1.printStackTrace();
}
if(sel.isEmpty())
combo.select(0);
else
combo.setText(sel);
}
}
示例4: initHttpCombo
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private void initHttpCombo( Composite top){
httpCombo = new Combo(top, SWT.READ_ONLY);
httpCombo.setItems(CoreConstants.HTTP11_METHODS);
httpCombo.setText(model.getHttpMethod());
httpCombo.addSelectionListener(new SelectionAdapter() {
private String prevMethod = model.getHttpMethod();
public void widgetSelected( SelectionEvent e){
// becomes GET, HEAD, PUT, etc
if (CoreConstants.HTTP_POST.equals(prevMethod) && !CoreConstants.HTTP_POST.equals(httpCombo.getText())) {
state.setState(ItemState.POST_DISABLED);
// becomes POST
} else if (!CoreConstants.HTTP_POST.equals(prevMethod) && CoreConstants.HTTP_POST.equals(httpCombo.getText())) {
state.setState(ItemState.POST_ENABLED);
// no update
} else {
state.setState(ItemState.POST_NO_UPDATE);
}
prevMethod = httpCombo.getText();
model.fireExecute(new ModelEvent(ModelEvent.HTTP_METHOD_CHANGE, model));
}
});
}
示例5: addSecondSection
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private void addSecondSection(Composite parent, Preferences prefs) {
Composite composite = createDefaultComposite(parent);
// Label for owner field
Label ownerLabel = new Label(composite, SWT.NONE);
ownerLabel.setText(MINIFIER_TITLE);
// Create a single-selection list
selection = new Combo(composite, SWT.READ_ONLY);
// Add the items, one by one
for (int i = 0; i < options()[0].length; i++) {
selection.add(options()[1][i]);
}
selection.setText(options()[1][0]);
// Set current selection
String minifier = prefs.get(preferenceKey(MinifyBuilder.MINIFIER),
MinifyBuilder.DONT_MINIFY);
if (!minifier.equals(MinifyBuilder.DONT_MINIFY)) {
for (int i = 0; i < options()[0].length; i++) {
if (minifier.equals(options()[0][i])) {
selection.setText(options()[1][i]);
break;
}
}
}
}
示例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: 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);
}
}
示例8: populateTypeCombo
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private void populateTypeCombo(final Combo combo) {
final String oldType = combo.getText();
combo.removeAll();
String[] types;
if (selectedProjectIndex >= 0) {
final Project project = projects[selectedProjectIndex];
final WorkItemType[] witTypes = project.getWorkItemTypes().getTypes();
types = new String[witTypes.length];
for (int i = 0; i < witTypes.length; i++) {
types[i] = witTypes[i].getName();
}
} else {
types = uniqueTypeNames;
}
Arrays.sort(types);
combo.add(""); //$NON-NLS-1$
boolean foundOldType = false;
for (int i = 0; i < types.length; i++) {
combo.add(types[i]);
if (types[i].equals(oldType)) {
foundOldType = true;
}
}
if (foundOldType) {
combo.setText(oldType);
} else {
combo.setText(""); //$NON-NLS-1$
}
}
示例9: restoreCombo
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/**
* Restores the items of a combo box.
*
* @param settings
* dialog setting used to persist the history
* @param key
* key used for this combo box
* @param combo
* the combo box
*/
public static void restoreCombo(IDialogSettings settings, String key,
Combo combo) {
String[] destinations = settings.getArray(key);
if (destinations != null) {
combo.setItems(destinations);
if (destinations.length > 0) {
combo.setText(destinations[0]);
}
}
}
示例10: createFileEncodingCombo
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
public static Combo createFileEncodingCombo(final String defaultCharset, final AbstractDialog dialog, final Composite composite, final String title, final int span) {
final Combo fileEncodingCombo = createReadOnlyCombo(dialog, composite, title, span, -1);
for (final Charset charset : Charset.availableCharsets().values()) {
fileEncodingCombo.add(charset.displayName());
}
fileEncodingCombo.setText(defaultCharset);
return fileEncodingCombo;
}
示例11: createTypeCombo
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private Combo createTypeCombo(final NormalColumn targetColumn) {
final GridData gridData = new GridData();
gridData.widthHint = 100;
final Combo typeCombo = new Combo(attributeTable, SWT.READ_ONLY);
initializeTypeCombo(typeCombo);
typeCombo.setLayoutData(gridData);
typeCombo.addSelectionListener(new SelectionAdapter() {
/**
* {@inheritDoc}
*/
@Override
public void widgetSelected(final SelectionEvent event) {
validate();
}
});
final SqlType sqlType = targetColumn.getType();
final String database = diagram.getDatabase();
if (sqlType != null && sqlType.getAlias(database) != null) {
typeCombo.setText(sqlType.getAlias(database));
}
return typeCombo;
}
示例12: set
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
public static void set(Combo combo, String str) {
String strToSet = str==null ? "" : str;
if (!combo.getText().equals(strToSet)) {
combo.setText(strToSet);
combo.setSelection(new Point(strToSet.length(), strToSet.length()));
}
// combo.setText(str==null?"":str);
}
示例13: createFileEncodingCombo
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
public static Combo createFileEncodingCombo(String defaultCharset,
AbstractDialog dialog, Composite composite, String title, int span) {
Combo fileEncodingCombo = createReadOnlyCombo(dialog, composite, title,
span, -1);
for (Charset charset : Charset.availableCharsets().values()) {
fileEncodingCombo.add(charset.displayName());
}
fileEncodingCombo.setText(defaultCharset);
return fileEncodingCombo;
}
示例14: createTypeCombo
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private Combo createTypeCombo(NormalColumn targetColumn) {
GridData gridData = new GridData();
gridData.widthHint = 100;
final Combo typeCombo = new Combo(this.attributeTable, SWT.READ_ONLY);
initializeTypeCombo(typeCombo);
typeCombo.setLayoutData(gridData);
typeCombo.addSelectionListener(new SelectionAdapter() {
/**
* {@inheritDoc}
*/
@Override
public void widgetSelected(SelectionEvent event) {
validate();
}
});
SqlType sqlType = targetColumn.getType();
String database = this.diagram.getDatabase();
if (sqlType != null && sqlType.getAlias(database) != null) {
typeCombo.setText(sqlType.getAlias(database));
}
return typeCombo;
}
示例15: createDialogArea
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
GridLayout layout = new GridLayout(3, false);
layout.marginRight = 5;
layout.marginLeft = 10;
container.setLayout(layout);
/*
* Corpus name
*/
new Label(container, SWT.NONE).setText("Name:");
nameText = new Text(container, SWT.BORDER | SWT.SINGLE);
nameText.setText("");
nameText.addKeyListener(updateAdapater);
GridDataFactory.fillDefaults().grab(true, false).span(2, 1).applyTo(nameText);
/*
* Corpus path
*/
new Label(container, SWT.NONE).setText("Root directory of corpus:");
pathText = new Text(container, SWT.BORDER | SWT.SINGLE);
pathText.setText("");
pathText.addKeyListener(updateAdapater);
GridDataFactory.fillDefaults().grab(true, false).applyTo(pathText);
Button browse = new Button(container, SWT.NONE);
browse.setText("Browse...");
browse.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
DirectoryDialog directoryDialog = new DirectoryDialog(parent.getShell());
directoryDialog.setMessage("Select a multi-lingual corpus.");
directoryDialog.setText("Import multilingual Corpus");
pathText.setText(directoryDialog.open());
update();
}
});
GridDataFactory.swtDefaults().applyTo(browse);
/*
* Corpus encoding
*/
new Label(container, SWT.NONE).setText("Encoding of the corpus:");
encodingCombo = new Combo(container, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.SINGLE);
encodingCombo.setItems(availableCharsets.toArray(new String[availableCharsets.size()]));
encodingCombo.setText(availableCharsets.get(0));
GridDataFactory.fillDefaults().span(2, 1).applyTo(encodingCombo);
/*
* Status message
*/
statusText = new Label(container, SWT.NONE);
statusText.setText("");
statusText.setForeground(TermSuiteUI.COLOR_RED);
GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.END).span(3, 1).applyTo(statusText);
return container;
}