1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
tree.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
//final int column = cursor.getColumn();
// Clean up any previous editor control
Control oldEditor = editor1.getEditor();
if (oldEditor != null) oldEditor.dispose();
oldEditor = editor2.getEditor();
if (oldEditor != null) oldEditor.dispose();
oldEditor = editor3.getEditor();
if (oldEditor != null) oldEditor.dispose();
oldEditor = editor4.getEditor();
if (oldEditor != null) oldEditor.dispose();
TreeItem item = (TreeItem)e.item;
if (item == null) return;
// For OTD
// The control that will be the editor must be a child of the Tree
Text newEditor = new Text(tree, SWT.NONE);
newEditor.setText(item.getText(3));
newEditor.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
Text text = (Text)editor1.getEditor();
editor1.getItem().setText(3,text.getText());
}
});
newEditor.selectAll();
newEditor.setFocus();
editor1.setEditor(newEditor, item,3);
// For Depth before regrooving
// The control that will be the editor must be a child of the Tree
Text newEditor2 = new Text(tree, SWT.NONE);
newEditor2.setText(item.getText(4));
newEditor2.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
Text text = (Text)editor2.getEditor();
editor2.getItem().setText(4,text.getText());
}
});
newEditor2.selectAll();
newEditor2.setFocus();
editor2.setEditor(newEditor2, item,4);
// For Regrooving depth
// The control that will be the editor must be a child of the Tree
Text newEditor3 = new Text(tree, SWT.NONE);
newEditor3.setText(item.getText(5));
newEditor3.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
Text text = (Text)editor3.getEditor();
editor3.getItem().setText(5,text.getText());
}
});
newEditor3.selectAll();
newEditor3.setFocus();
editor3.setEditor(newEditor3, item,5);
// For rtdMin
// The control that will be the editor must be a child of the Tree
Text newEditor4 = new Text(tree, SWT.NONE);
newEditor4.setText(item.getText(6));
newEditor4.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
Text text = (Text)editor4.getEditor();
editor4.getItem().setText(6,text.getText());
}
});
newEditor4.selectAll();
newEditor4.setFocus();
editor4.setEditor(newEditor4, item,6);
}
}); |
Partager