@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); composite.setLayout(new FillLayout()); tableEditor = new MetadataEmfTableEditor(""); MetadataTable metadataTable = form.getMetadataTable(); tableEditor.setMetadataTable(metadataTable); // tableEditor.removeAll(); List<MetadataColumn> list = (List<MetadataColumn>) form.getSchemaViewer().getInput(); tableEditor.addAll(list); // if (list.size() > 0) { // for (MetadataColumn column : list) { // boolean toAdd = true; // for (int i = 0; i < currentColumnList.size(); i++) { // String label = column.getLabel(); // String curLabel = currentColumnList.get(i).getLabel(); // if (label.equals(curLabel)) { // toAdd = false; // break; // } // } // if (toAdd) { // tableEditor.add(column); // } // } // } tableEditorView = new MetadataEmfTableEditorView(composite, SWT.NONE); tableEditorView.setMetadataEditor(tableEditor); addListeners(); return composite; }
protected void addListeners() { tableEditor.addModifiedBeanListener( new IModifiedBeanListener<MetadataColumn>() { public void handleEvent(ModifiedBeanEvent<MetadataColumn> event) { if (AbstractMetadataTableEditorView.ID_COLUMN_NAME.equals(event.column.getId())) { MetadataColumn modifiedColumn = event.bean; if (modifiedColumn != null) { String originalLabel = changedNameColumns.get(modifiedColumn); if (originalLabel == null) { changedNameColumns.put(modifiedColumn, (String) event.previousValue); } } } } }); }
public MetadataTable getMetadataTable() { return tableEditor.getMetadataTable(); }