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


Java List.addKeyListener方法代碼示例

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


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

示例1: createSelectAllMenuItem

import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
protected MenuItem createSelectAllMenuItem(final List list) {
	final MenuItem selectAll = new MenuItem(contextMenu, SWT.PUSH);
	selectAll.setText(JFaceMessages.get("lbl.menu.item.select.all") + SwtUtils.getMod1ShortcutLabel(SwtUtils.KEY_SELECT_ALL));
	selectAll.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(final SelectionEvent se) {
			list.selectAll();
		}
	});
	list.addKeyListener(new KeyAdapter() {
		@Override
		public void keyPressed(final KeyEvent ke) {
			if (ke.stateMask == SWT.MOD1 && ke.keyCode == SwtUtils.KEY_SELECT_ALL) {
				ke.doit = false;
				list.selectAll();
			}
		}
	});
	return selectAll;
}
 
開發者ID:Albertus82,項目名稱:JFaceUtils,代碼行數:21,代碼來源:ListConsole.java

示例2: createCopyMenuItem

import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
protected MenuItem createCopyMenuItem(final List list) {
	final MenuItem copy = new MenuItem(contextMenu, SWT.PUSH);
	copy.setText(JFaceMessages.get("lbl.menu.item.copy") + SwtUtils.getMod1ShortcutLabel(SwtUtils.KEY_COPY));
	copy.setAccelerator(SWT.MOD1 | SwtUtils.KEY_COPY);
	copy.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(final SelectionEvent se) {
			copy(list);
		}
	});
	list.addKeyListener(new KeyAdapter() {
		@Override
		public void keyPressed(final KeyEvent e) {
			if (e.stateMask == SWT.MOD1 && e.keyCode == SwtUtils.KEY_COPY) {
				e.doit = false; // avoids unwanted scrolling
				copy(list);
			}
		}
	});
	return copy;
}
 
開發者ID:Albertus82,項目名稱:JFaceUtils,代碼行數:22,代碼來源:ListConsole.java

示例3: createDropDownList

import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
@Override
protected List createDropDownList(final Composite parent) {
	final List list = super.createDropDownList(parent);
	if (list.getMenu() != null) {
		for (final MenuItem item : list.getMenu().getItems()) {
			if (item.getText().equals(JFaceResources.getString("copy"))) {
				item.setText(JFaceMessages.get("lbl.menu.item.copy") + SwtUtils.getMod1ShortcutLabel(SwtUtils.KEY_COPY));
				item.setAccelerator(SWT.MOD1 | SwtUtils.KEY_COPY);
				list.addKeyListener(new KeyAdapter() {
					@Override
					public void keyPressed(final KeyEvent e) {
						if (SWT.MOD1 == e.stateMask && SwtUtils.KEY_COPY == e.keyCode) {
							e.doit = false; // avoids unwanted scrolling
							item.notifyListeners(SWT.Selection, null);
						}
					}
				});
				break;
			}
		}
	}
	return list;
}
 
開發者ID:Albertus82,項目名稱:JFaceUtils,代碼行數:24,代碼來源:EnhancedErrorDialog.java

示例4: createDialogArea

import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
 * This is the method that puts the content into the popup's
 * dialog area.  It puts an org.eclipse.swt.widgets.List
 * (note that this isn't an ordinary Java List) there.
 * 
 */
protected Control createDialogArea(Composite composite)
{
    // create the list
    list = new List(composite, SWT.SINGLE | SWT.V_SCROLL | SWT.RESIZE);

    // Populate the popup's display area.
    setList();

    // list.addKeyListener(listener);

    /* 
     *  To put a Composite instead of a List in the
     *  dialog area, do something like the following:
    Composite stuff = new Composite(composite, SWT.NONE);
    stuff.setLayoutData(new GridData());
    stuff.setLayout(new FillLayout(SWT.VERTICAL));
    Button button1 = new Button(stuff, SWT.FLAT);
    button1.setText("Button 1");
    // button1.setParent(stuff);
    Button button2 = new Button(stuff, SWT.PUSH);
    button2.setText("Button 2");
    */
    list.addSelectionListener(new ShowDeclarationsSelectionListener(EditorUtil.getTLAEditorWithFocus()));

    // Adding the KeyListener after the SelectionListener is necessary for the handling
    // of keystrokes to work. If they're added in the opposite order, some keys change
    // the selection and call the SelectionListener.

    list.addKeyListener(new ShowDeclarationsKeyListener(this)); // Testing

    // System.out.println("testing showAll = " + showAll);

    // It is necessary to select an item on the list if one is to be
    // able to listen for keystrokes. Otherwise, a keystroke causes the
    // current selection to change, calling the SelectionListener's widgetSelected()
    // method.
    list.setSelection(0);
    return list;
}
 
開發者ID:tlaplus,項目名稱:tlaplus,代碼行數:46,代碼來源:ShowDeclarationsHandler.java

示例5: createList

import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
 * List UI 생성
 * 
 * @param operations
 *            void
 */
private void createList() {

    Display display = this.getCurrentViewer().getControl().getShell().getDisplay();
    Shell shell = new Shell(display);
    org.eclipse.swt.graphics.Point currentPoint = this.getCurrentViewer()
        .getControl()
        .getDisplay()
        .getCursorLocation();
    shell.setLocation(currentPoint.x, currentPoint.y);

    dialog = new Shell(shell, SWT.TOOL | SWT.APPLICATION_MODAL);
    dialog.setSize(120, 50);
    dialog.setLocation(currentPoint.x, currentPoint.y);
    dialog.setLayout(new FillLayout());
    final List list = new List(dialog, SWT.SINGLE | SWT.V_SCROLL);

    list.add(UMLMessage.getMessage(UMLMessage.LABEL_NO_TYPE));
    list.add(UMLMessage.getMessage(UMLMessage.LABEL_CREATE_CLASS));
    list.add(UMLMessage.getMessage(UMLMessage.LABEL_SELECT_TYPE));

    list.select(0);
    list.addFocusListener(this);
    list.addKeyListener(this);
    list.addMouseListener(this);

    dialog.open();
    while (!dialog.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    shell.dispose();
}
 
開發者ID:SK-HOLDINGS-CC,項目名稱:NEXCORE-UML-Modeler,代碼行數:40,代碼來源:LifeLineCreationToolWithAdditionalInformation.java

示例6: handleExtendRelationship

import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
 * handleExtendRelationship
 *  
 * @param command
 * @return boolean
 */
private boolean handleExtendRelationship(CreateConnectionCommand command) {
    if (!command.isExpensible()) {
        return true;
    }
    if (!command.getConnection().getRelationType().equals(RelationType.EXTEND)) {
        return true;
    }

    UseCase useCase = (UseCase) command.getTarget().getUmlModel();

    Display display = this.getCurrentViewer().getControl().getShell().getDisplay();
    Shell shell = new Shell(display);
    org.eclipse.swt.graphics.Point currentPoint = this.getCurrentViewer()
        .getControl()
        .getDisplay()
        .getCursorLocation();
    shell.setLocation(currentPoint.x, currentPoint.y);

    dialog = new Shell(shell, SWT.TOOL | SWT.APPLICATION_MODAL);
    dialog.setSize(180, 80);
    dialog.setLocation(currentPoint.x, currentPoint.y);
    dialog.setLayout(new FillLayout());
    final List list = new List(dialog, SWT.SINGLE | SWT.V_SCROLL);

    list.add("<New>");
    for (ExtensionPoint extensionPoint : useCase.getExtensionPoints()) {
        list.add(extensionPoint.getName());
    }
    list.select(0);
    list.addFocusListener(this);
    list.addKeyListener(this);
    list.addMouseListener(this);

    dialog.open();
    while (!dialog.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    shell.dispose();

    if (-1 == selectedIndex) {
        return false;
    } else if (0 == selectedIndex) {
        command.setExtensionPoint(null);
        return true;
    } else {
        command.setExtensionPoint(useCase.getExtensionPoints().get(selectedIndex - 1));
        return true;
    }
}
 
開發者ID:SK-HOLDINGS-CC,項目名稱:NEXCORE-UML-Modeler,代碼行數:58,代碼來源:ConnectionCreationToolForUsecaseDiagramRelationship.java

示例7: createList

import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
 * List UI 생성
 * 
 * @param operations
 *            void
 */
private void createList(java.util.List<Operation> operations) {

    Display display = this.getCurrentViewer().getControl().getShell().getDisplay();
    Shell shell = new Shell(display);
    org.eclipse.swt.graphics.Point currentPoint = this.getCurrentViewer()
        .getControl()
        .getDisplay()
        .getCursorLocation();
    shell.setLocation(currentPoint.x, currentPoint.y);

    dialog = new Shell(shell, SWT.TOOL | SWT.APPLICATION_MODAL);

    dialog.setLocation(currentPoint.x, currentPoint.y);
    dialog.setLayout(new FillLayout());
    final List list = new List(dialog, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL);
    list.add("<New>");

    // operation을 list에 보여준다.
    if (operations != null) {
        for (Operation operation : operations) {
            list.add(SequenceUtil.getOperationVisibility(operation) + UICoreConstant.PROJECT_CONSTANTS__BLANK
                + ((NamedElement) operation.eContainer()).getName()
                + UICoreConstant.PROJECT_CONSTANTS__DOUBLE_COLON + operation.getName() + " ()");
        }
    }

    list.select(0);
    list.addFocusListener(this);
    list.addKeyListener(this);
    list.addMouseListener(this);
    int x, y;
    x = 300;
    y = list.getItems().length * 13;
    y = y < 100 ? 100 : y;
    y = y > 400 ? 400 : y;
    dialog.setSize(x, y);

    selectedIndex = -1;
    dialog.open();
    while (!dialog.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    shell.dispose();
}
 
開發者ID:SK-HOLDINGS-CC,項目名稱:NEXCORE-UML-Modeler,代碼行數:53,代碼來源:MessageCreationToolForSequenceDiagramRelationship.java

示例8: createDialogArea

import org.eclipse.swt.widgets.List; //導入方法依賴的package包/類
/**
 * This is the method that puts the content into the popup's
 * dialog area.  It puts an org.eclipse.swt.widgets.List
 * (note that this isn't an ordinary Java List) there.
 * 
 * This is identical to the corresponding method in 
 * ShowDeclarationsHandler except for the obvious name changes
 * and the different setList method.  See that method
 * for the comments.
 * 
 */
protected Control createDialogArea(Composite composite)
{
    list = new List(composite, SWT.SINGLE | SWT.V_SCROLL | SWT.RESIZE);
    setList();
    list.addSelectionListener(new ShowUsesSelectionListener(this.showUses, this.moduleList)); // EditorUtil.getTLAEditorWithFocus()));
    list.addKeyListener(new ShowUsesKeyListener(this)); // Testing
    list.setSelection(0);
    return list;
}
 
開發者ID:tlaplus,項目名稱:tlaplus,代碼行數:21,代碼來源:ShowUsesHandler.java


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