本文整理匯總了Java中org.eclipse.swt.widgets.List.getSelectionIndex方法的典型用法代碼示例。如果您正苦於以下問題:Java List.getSelectionIndex方法的具體用法?Java List.getSelectionIndex怎麽用?Java List.getSelectionIndex使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.List
的用法示例。
在下文中一共展示了List.getSelectionIndex方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: openEditorDialog
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* Open the config editor dialog for editing an existing configuration.
* This is called, when edit button is pressed.
*/
private void openEditorDialog() {
List list = getListControl(parent);
int index = list.getSelectionIndex();
if (index < 0) {
// no item selected from the list, do nothing
return;
}
String name = list.getItem(index);
if (name == null || name.length() == 0) {
// no name for the item, can't load config
return;
}
registry.setActiveViewer(name.substring(0, name.indexOf('(')-1));
ViewerConfigDialog dialog = new ViewerConfigDialog(editButton.getShell(),
(ViewerAttributeRegistry) registry.clone());
int code = dialog.open();
if (code == Window.OK) {
registry.mergeWith(dialog.getRegistry());
list.setItem(index, registry.getActiveViewer() + " (" + registry.getCommand() + ")");
}
}
示例2: handleEditInList
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
private void handleEditInList(List inlist) {
int index = inlist.getSelectionIndex() + 1;
if (index >= 0 && index < operands.size()) {
OperandDialog dialog = new OperandDialog(getShell());
dialog.setValues(value, new ArrayList<AOperand>(operands), index);
if (dialog.open() == Dialog.OK) {
operands.set(index, dialog.getOperand());
showInList(inlist);
}
}
}
示例3: copy
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
private void copy(final List list) {
if (list.getSelectionIndex() != -1) {
final StringBuilder text = new StringBuilder();
for (int i = 0; i < list.getSelectionCount(); i++) {
text.append(list.getSelection()[i]);
if (i != list.getSelectionCount() - 1) {
text.append(newLine);
}
}
final Clipboard clipboard = new Clipboard(list.getDisplay());
clipboard.setContents(new String[] { text.toString() }, new TextTransfer[] { TextTransfer.getInstance() });
clipboard.dispose();
}
}
示例4: widgetSelected
import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
* Handler for Network LIst selections
*
*/
public void widgetSelected(SelectionEvent e) {
// Get selected item text
List source = (List) e.getSource();
int index = source.getSelectionIndex();
String ip = m_ips.get(index);
if(ip == "" || ip == null) { return; }
else {
displayQRImage(ip);
}
}