本文整理匯總了Java中org.eclipse.swt.widgets.Combo.getText方法的典型用法代碼示例。如果您正苦於以下問題:Java Combo.getText方法的具體用法?Java Combo.getText怎麽用?Java Combo.getText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.Combo
的用法示例。
在下文中一共展示了Combo.getText方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
}
示例2: runWithEvent
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
@Override
public void runWithEvent(Event event) {
Shell shell = getActiveWorkbenchShell();
if (shell != null) {
String sel = null;
if (event.widget instanceof Combo) {
Combo combo = (Combo) event.widget;
sel = combo.getText();
Point selection = combo.getSelection();
sel = sel.substring(selection.x, selection.y);
} else if (event.widget instanceof Text) {
Text text = (Text) event.widget;
sel = text.getSelectionText();
}
if (sel != null) {
if (sel.length() > 0) {
copyToClipboard(sel, shell);
}
return;
}
}
run();
}
示例3: createControl
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
public void createControl(Composite parent) {
super.createControl(parent);
Composite composite = (Composite) getControl();
Group group = new Group(composite, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
group.setLayout(layout);
group.setText("設置");
group.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
Label label = new Label(group, SWT.NULL);
label.setText("數據庫方言:");
final Combo combo = new Combo(group, SWT.READ_ONLY);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
combo.setLayoutData(gd);
DbType[] values = DbType.values();
for (DbType type : values) {
combo.add(type.name());
}
combo.select(0);
currentDbType = combo.getText();
setFileName("NewFile" + DEFAULT_EXTENSION);
combo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
currentDbType = combo.getText();
}
});
setPageComplete(validatePage());
}
示例4: 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$
}
}
示例5: validate
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
/**
* Called by subclasses inside the subclass constructor to perform the
* initial validation of the subject. Normally, there is no need for
* subclasses to override.
*/
protected void validate() {
final Combo subject = getComboControlSubject();
final String text = subject.getText();
validate(text);
}