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


Java List.getSelectionCount方法代碼示例

本文整理匯總了Java中org.eclipse.swt.widgets.List.getSelectionCount方法的典型用法代碼示例。如果您正苦於以下問題:Java List.getSelectionCount方法的具體用法?Java List.getSelectionCount怎麽用?Java List.getSelectionCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.swt.widgets.List的用法示例。


在下文中一共展示了List.getSelectionCount方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: copy

import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
 * Copies the current selection to the clipboard.
 * 
 * @param list the data source
 */
protected void copy(final List list) {
	if (canCopy(list)) {
		final StringBuilder data = new StringBuilder();

		for (int row = 0; row < list.getSelectionCount(); row++) {
			data.append(list.getSelection()[row]);
			if (row != list.getSelectionCount() - 1) {
				data.append(NewLine.SYSTEM_LINE_SEPARATOR);
			}
		}

		final Clipboard clipboard = new Clipboard(list.getDisplay());
		clipboard.setContents(new String[] { data.toString() }, new TextTransfer[] { TextTransfer.getInstance() });
		clipboard.dispose();
	}
}
 
開發者ID:Albertus82,項目名稱:JFaceUtils,代碼行數:22,代碼來源:SystemInformationDialog.java

示例2: applyChanges

import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
private static final void applyChanges(Shell shell, List list, Control control, int position,
    InsertTextInterface insertTextInterface) {
  String extra = "${" + list.getSelection()[0] + "}";
  if (insertTextInterface != null) {
    insertTextInterface.insertText(extra, position);
  } else {
    if (control.isDisposed())
      return;

    if (list.getSelectionCount() <= 0)
      return;
    if (control instanceof Text) {
  	  ((Text)control).insert(extra);
    } else if (control instanceof CCombo) {
  	  CCombo combo = (CCombo)control;
  	  combo.setText(extra); // We can't know the location of the cursor yet. All we can do is overwrite.
    } 
  }
  if (!shell.isDisposed())
    shell.dispose();
  if (!control.isDisposed()) control.setData(Boolean.FALSE);
}
 
開發者ID:icholy,項目名稱:geokettle-2.0,代碼行數:23,代碼來源:ControlSpaceKeyAdapter.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: applyChanges

import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
private static final void applyChanges(Shell shell, List list, Control control, int position,
    InsertTextInterface insertTextInterface) {
  String extra = "${" + list.getSelection()[0] + "}";
  if (insertTextInterface != null) {
    insertTextInterface.insertText(extra, position);
  } else {
    if (control.isDisposed())
      return;

    if (list.getSelectionCount() <= 0)
      return;
    if (control instanceof Text) {
  	  ((Text)control).insert(extra);
    } else if (control instanceof CCombo) {
  	  CCombo combo = (CCombo)control;
  	  combo.setText(extra); // We can't know the location of the cursor yet. All we can do is overwrite.
    } else if (control instanceof StyledTextComp) {
  	  ((StyledTextComp)control).insert(extra);
    } 
    else if (control instanceof StyledText) {
  	  ((StyledText)control).insert(extra);
    } 
  }
  if (!shell.isDisposed())
    shell.dispose();
  if (!control.isDisposed()) control.setData(Boolean.FALSE);
}
 
開發者ID:yintaoxue,項目名稱:read-open-source-code,代碼行數:28,代碼來源:ControlSpaceKeyAdapter.java

示例5: canCopy

import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
protected boolean canCopy(final List list) {
	return !list.isDisposed() && list.getSelectionCount() > 0;
}
 
開發者ID:Albertus82,項目名稱:JFaceUtils,代碼行數:4,代碼來源:SystemInformationDialog.java


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