Eclipse的DialogCellEditor是由一个Label和一个Button组成的,不能直接进行编辑,必须通过弹出对话框才能编辑和输入,于是我通过继承DialogCellEditor实现自定义控件。
1、首先重载createContents
@Override
protected Control createContents(final Composite cell) {
// return the control on an edit-request
//this.label = new Label(cell, SWT.NONE);
//this.setValue(""+12);
this.text=new Text(cell,SWT.NONE);
this.text.addFocusListener(new FocusListener(){
public void focusGained(FocusEvent e) {
// TODO Auto-generated method stub
}
public void focusLost(FocusEvent e) {
// TODO Auto-generated method stub
doSetValue(text.getText());
}
});
this.text.addKeyListener(new KeyListener(){
public void keyPressed(KeyEvent e) {
// TODO Auto-generated method stub
if(e.ke