use of org.jkiss.dbeaver.tools.transfer.wizard.DataTransferPipe in project dbeaver by serge-rider.
the class DatabaseConsumerPageMapping method activatePage.
@Override
public void activatePage() {
final DatabaseConsumerSettings settings = getWizard().getPageSettings(this, DatabaseConsumerSettings.class);
settings.loadNode(getContainer());
DBNDatabaseNode containerNode = settings.getContainerNode();
if (containerNode != null) {
containerIcon.setImage(DBeaverIcons.getImage(containerNode.getNodeIconDefault()));
containerName.setText(containerNode.getNodeFullName());
}
if (mappingViewer.getInput() == null) {
Map<DBSDataContainer, DatabaseMappingContainer> dataMappings = settings.getDataMappings();
for (DataTransferPipe pipe : getWizard().getSettings().getDataPipes()) {
if (pipe.getProducer() == null) {
continue;
}
DBSDataContainer sourceObject = (DBSDataContainer) pipe.getProducer().getSourceObject();
if (!dataMappings.containsKey(sourceObject)) {
DatabaseMappingContainer mapping;
if (pipe.getConsumer() instanceof DatabaseTransferConsumer && ((DatabaseTransferConsumer) pipe.getConsumer()).getTargetObject() != null) {
try {
mapping = new DatabaseMappingContainer(getContainer(), sourceObject, ((DatabaseTransferConsumer) pipe.getConsumer()).getTargetObject());
} catch (DBException e) {
setMessage(e.getMessage(), IMessageProvider.ERROR);
mapping = new DatabaseMappingContainer(sourceObject);
}
} else {
mapping = new DatabaseMappingContainer(sourceObject);
}
dataMappings.put(sourceObject, mapping);
}
}
List<DatabaseMappingContainer> model = new ArrayList<>(dataMappings.values());
mappingViewer.setInput(model);
Tree table = mappingViewer.getTree();
int totalWidth = table.getClientArea().width;
TreeColumn[] columns = table.getColumns();
columns[0].setWidth(totalWidth * 40 / 100);
columns[1].setWidth(totalWidth * 40 / 100);
columns[2].setWidth(totalWidth * 20 / 100);
}
updatePageCompletion();
}
use of org.jkiss.dbeaver.tools.transfer.wizard.DataTransferPipe in project dbeaver by serge-rider.
the class DatabaseConsumerSettings method isCompleted.
public boolean isCompleted(Collection<DataTransferPipe> pipes) {
for (DataTransferPipe pipe : pipes) {
if (pipe.getProducer() != null) {
DBSDataContainer sourceObject = (DBSDataContainer) pipe.getProducer().getSourceObject();
DatabaseMappingContainer containerMapping = dataMappings.get(sourceObject);
if (containerMapping == null || containerMapping.getMappingType() == DatabaseMappingType.unspecified || !containerMapping.isCompleted()) {
return false;
}
}
}
return true;
}
Aggregations