use of org.talend.core.ui.metadata.extended.command.MetadataEmfPasteCommand in project tdi-studio-se by Talend.
the class HL7MetadataEmfToolbarEditor method createPastePushButton.
/*
* (non-Javadoc)
*
* @see org.talend.core.ui.extended.ExtendedToolbarView#createPastButton()
*/
@Override
public PastePushButton createPastePushButton() {
return new PastePushButtonForExtendedTable(toolbar, extendedTableViewer) {
@Override
protected Command getCommandToExecute(ExtendedTableModel extendedTableModel, Integer indexWhereInsert) {
return new MetadataEmfPasteCommand(extendedTableModel, indexWhereInsert);
}
@Override
public boolean getEnabledState() {
// 13749
return super.getEnabledState() && !isRepository;
}
@Override
protected void afterCommandExecution(Command executedCommand) {
MetadataEmfTableEditor tableEditorModel = (MetadataEmfTableEditor) getExtendedTableViewer().getExtendedControlModel();
IStructuredSelection selection = (IStructuredSelection) ((HL7MultiSchemaUI) linker.getMainui()).getMetaTableViewer().getSelection();
Object selectedObj = selection.getFirstElement();
if (selectedObj != null) {
String key = ((IModel) selectedObj).getDisplayName();
List<MetadataColumn> metadataColumnList = tableEditorModel.getMetadataColumnList();
Map<String, List<MetadataColumn>> schemaRelationMap = linker.getManager().getSchemaRelationMap();
if (schemaRelationMap != null) {
List<MetadataColumn> schemas = new ArrayList<MetadataColumn>();
schemas.addAll(metadataColumnList);
schemaRelationMap.put(key, schemas);
}
}
}
};
}
Aggregations