當前位置: 首頁>>代碼示例>>Java>>正文


Java List.getSelectionIndex方法代碼示例

本文整理匯總了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() + ")");
    }
}
 
開發者ID:eclipse,項目名稱:texlipse,代碼行數:30,代碼來源:ViewerListFieldEditor.java

示例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);
		}
	}
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:12,代碼來源:EditExpressionXDialog.java

示例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();
	}
}
 
開發者ID:Albertus82,項目名稱:JFaceUtils,代碼行數:15,代碼來源:ListConsole.java

示例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);
	}
}
 
開發者ID:Kenishi,項目名稱:DroidNavi,代碼行數:16,代碼來源:PairingWindow.java


注:本文中的org.eclipse.swt.widgets.List.getSelectionIndex方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。