1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-29 11:55:40 +02:00

RESOLVED - bug 211659: Add FieldAssist to the terminal input field

https://bugs.eclipse.org/bugs/show_bug.cgi?id=211659
(coments added)
This commit is contained in:
Michael Scharf 2008-01-22 22:40:51 +00:00
parent e621ad0716
commit 236027f61c

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007 Wind River Systems, Inc. and others.
* Copyright (c) 2007, 2008 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -7,10 +7,10 @@
*
* Contributors:
* Michael Scharf (Wind River) - initial implementation
* Michael Scharf (Wing River) - fixed https://bugs.eclipse.org/bugs/show_bug.cgi?id=211659
*******************************************************************************/
package org.eclipse.tm.internal.terminal.control;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
@ -30,6 +30,7 @@ import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter;
/**
* Manages the Command History for the command line input
* of the terminal control.
@ -211,7 +212,10 @@ public class CommandInputFieldWithHistory implements ICommandInputField {
}
fInputField.setLayoutData(data);
fInputField.setFont(terminal.getFont());
// register the field assist
// Register field assist *before* the key listener.
// Else the ENTER key is sent *first* to the input field
// and then to the field assist popup.
// (https://bugs.eclipse.org/bugs/show_bug.cgi?id=211659)
new ContentAssistCommandAdapter(
fInputField,
new TextContentAdapter(),
@ -221,6 +225,8 @@ public class CommandInputFieldWithHistory implements ICommandInputField {
installDecoration);
fInputField.addKeyListener(new KeyListener(){
public void keyPressed(KeyEvent e) {
// if the field assist has handled the key already then
// ignore it (https://bugs.eclipse.org/bugs/show_bug.cgi?id=211659)
if(!e.doit)
return;
if(e.keyCode=='\n' || e.keyCode=='\r') {