本文整理匯總了Java中org.eclipse.swt.widgets.Combo.getItemCount方法的典型用法代碼示例。如果您正苦於以下問題:Java Combo.getItemCount方法的具體用法?Java Combo.getItemCount怎麽用?Java Combo.getItemCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.Combo
的用法示例。
在下文中一共展示了Combo.getItemCount方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: containsItem
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private boolean containsItem(Combo combo, String item) {
for(int i = 0; i < combo.getItemCount(); i++)
if(combo.getItem(i).equals(item))
return true;
return false;
}
示例2: populateTreeOptionsCombo
import org.eclipse.swt.widgets.Combo; //導入方法依賴的package包/類
private void populateTreeOptionsCombo(final Combo combo, final String initialValue) {
int selectedItemIndex = 0;
final ArrayList list = new ArrayList();
mapTreeDisplayNameToReferenceName = new HashMap();
final WorkItemLinkTypeCollection linkTypes = query.getWorkItemClient().getLinkTypes();
final WorkItemLinkTypeEndCollection endTypes = linkTypes.getLinkTypeEnds();
for (final Iterator it = endTypes.iterator(); it.hasNext();) {
final WorkItemLinkTypeEnd end = (WorkItemLinkTypeEnd) it.next();
if (end.getLinkType().getLinkTopology() == Topology.TREE && end.isForwardLink()) {
final String referenceName = end.getImmutableName();
final String display =
MessageFormat.format(Messages.getString("QueryEditorControl.HierarchyLinkTypeFormat"), new Object[] //$NON-NLS-1$
{
end.getOppositeEnd().getName(),
end.getName()
});
if (referenceName.equalsIgnoreCase(initialValue)) {
selectedItemIndex = list.size();
}
list.add(display);
mapTreeDisplayNameToReferenceName.put(display, referenceName);
}
}
combo.setItems((String[]) list.toArray(new String[list.size()]));
if (combo.getItemCount() > 0) {
combo.select(selectedItemIndex);
}
combo.addSelectionListener(new ComboTreeOptionsSelectionHandler());
}