protected CellEditor[] getCellEditors() throws ApplicationException { if (cellEditors != null) return cellEditors; if ((gridStyle & IGridViewer.fullEditable) == 0) { String[] columnNames = getColumnNames(); cellEditors = new CellEditor[columnNames.length]; for (int i = 0; i < columnNames.length; i++) { TextCellEditor tce = new TextCellEditor(tableViewer.getTable()); Text text = (Text) tce.getControl(); text.setEditable(false); cellEditors[i] = tce; } } else { List attrib_list = CompositeMapUtil.getArrayAttrs(data); cellEditors = new CellEditor[attrib_list.size()]; int id = 0; for (Iterator it = attrib_list.iterator(); it.hasNext(); ) { Attribute attrib = (Attribute) it.next(); ICellEditor cellEditor = CellEditorFactory.getInstance().createCellEditor(this, attrib, null, null); if (cellEditor != null) { cellEditors[id++] = cellEditor.getCellEditor(); addEditor(attrib.getLocalName(), cellEditor); } else { cellEditors[id++] = new TextCellEditor(tableViewer.getTable()); } } } return cellEditors; }
public String clearEditors(boolean validation) { Object[] editors = columnEditors.values().toArray(); // Not validate the null grid properties. if (getInput() != null && getInput().getChildsNotNull().size() > 0) { for (int i = 0; i < editors.length; i++) { ICellEditor ed = (ICellEditor) editors[i]; if (validation) { if (!ed.validValue(ed.getSelection())) { return ed.getErrorMessage(); } } } } for (int i = 0; i < editors.length; i++) { ICellEditor ed = (ICellEditor) editors[i]; ed.dispose(); } columnEditors.clear(); return null; }