use of org.jkiss.dbeaver.tools.transfer.DataTransferSettings in project dbeaver by dbeaver.
the class DatabaseProducerPageInputObjects method chooseEntityContainer.
protected DBSObjectContainer chooseEntityContainer() {
DataTransferSettings settings = getWizard().getSettings();
final DBNModel navigatorModel = DBWorkbench.getPlatform().getNavigatorModel();
final DBNNode rootNode = DBWorkbench.getPlatform().getWorkspace().getProjects().size() == 1 ? navigatorModel.getRoot().getProjectNode(DBWorkbench.getPlatform().getWorkspace().getActiveProject()) : navigatorModel.getRoot();
boolean chooseConsumer = settings.isConsumerOptional();
DBNNode node = DBWorkbench.getPlatformUI().selectObject(UIUtils.getActiveWorkbenchShell(), DTUIMessages.database_producer_page_input_objects_node_select_table, rootNode, lastSelection, new Class[] { DBSObjectContainer.class }, new Class[] { DBSObjectContainer.class }, null);
if (node instanceof DBNDatabaseNode) {
lastSelection = (DBNDatabaseNode) node;
return (DBSObjectContainer) ((DBNDatabaseNode) node).getObject();
}
return null;
}
use of org.jkiss.dbeaver.tools.transfer.DataTransferSettings in project dbeaver by dbeaver.
the class DataTransferPagePipes method loadConsumers.
private void loadConsumers() {
DataTransferSettings settings = getWizard().getSettings();
Collection<DBSObject> objects = settings.getSourceObjects();
List<TransferTarget> transferTargets = new ArrayList<>();
for (DataTransferNodeDescriptor consumer : DataTransferRegistry.getInstance().getAvailableConsumers(objects)) {
Collection<DataTransferProcessorDescriptor> processors = consumer.getAvailableProcessors(objects);
if (CommonUtils.isEmpty(processors)) {
transferTargets.add(new TransferTarget(consumer, null));
} else {
for (DataTransferProcessorDescriptor processor : processors) {
transferTargets.add(new TransferTarget(consumer, processor));
}
}
}
nodesTable.setInput(transferTargets);
}
use of org.jkiss.dbeaver.tools.transfer.DataTransferSettings in project dbeaver by serge-rider.
the class DatabaseProducerPageInputObjects method chooseEntityContainer.
protected DBSObjectContainer chooseEntityContainer() {
DataTransferSettings settings = getWizard().getSettings();
final DBNModel navigatorModel = DBWorkbench.getPlatform().getNavigatorModel();
final DBNNode rootNode = DBWorkbench.getPlatform().getWorkspace().getProjects().size() == 1 ? navigatorModel.getRoot().getProjectNode(DBWorkbench.getPlatform().getWorkspace().getActiveProject()) : navigatorModel.getRoot();
boolean chooseConsumer = settings.isConsumerOptional();
DBNNode node = DBWorkbench.getPlatformUI().selectObject(UIUtils.getActiveWorkbenchShell(), DTUIMessages.database_producer_page_input_objects_node_select_table, rootNode, lastSelection, new Class[] { DBSObjectContainer.class }, new Class[] { DBSObjectContainer.class }, null);
if (node instanceof DBNDatabaseNode) {
lastSelection = (DBNDatabaseNode) node;
return (DBSObjectContainer) ((DBNDatabaseNode) node).getObject();
}
return null;
}
use of org.jkiss.dbeaver.tools.transfer.DataTransferSettings in project dbeaver by serge-rider.
the class DatabaseProducerPageInputObjects method updateItemData.
private void updateItemData(TableItem item, DataTransferPipe pipe) {
DataTransferSettings settings = getWizard().getSettings();
if (pipe.getProducer() == null || pipe.getProducer().getDatabaseObject() == null) {
item.setImage(0, null);
item.setText(0, DTUIMessages.database_producer_page_input_objects_item_text_none);
} else {
item.setImage(0, DBeaverIcons.getImage(settings.getProducer().getIcon()));
item.setText(0, DBUtils.getObjectFullName(pipe.getProducer().getDatabaseObject(), DBPEvaluationContext.DML));
}
if (pipe.getConsumer() == null || pipe.getConsumer().getObjectName() == null) {
item.setImage(1, null);
item.setText(1, DTUIMessages.database_producer_page_input_objects_item_text_none);
} else {
item.setImage(1, DBeaverIcons.getImage(settings.getConsumer().getIcon()));
item.setText(1, pipe.getConsumer().getObjectName());
}
}
use of org.jkiss.dbeaver.tools.transfer.DataTransferSettings in project dbeaver by serge-rider.
the class DatabaseProducerPageInputObjects method chooseEntity.
protected boolean chooseEntity(DataTransferPipe pipe) {
DataTransferSettings settings = getWizard().getSettings();
final DBNModel navigatorModel = DBWorkbench.getPlatform().getNavigatorModel();
final DBNNode rootNode = DBWorkbench.getPlatform().getWorkspace().getProjects().size() == 1 ? navigatorModel.getRoot().getProjectNode(DBWorkbench.getPlatform().getWorkspace().getActiveProject()) : navigatorModel.getRoot();
boolean chooseConsumer = settings.isConsumerOptional();
DBNNode node = DBWorkbench.getPlatformUI().selectObject(UIUtils.getActiveWorkbenchShell(), chooseConsumer ? NLS.bind(DTUIMessages.database_producer_page_input_objects_node_select_target, pipe.getProducer().getDatabaseObject().getName()) : NLS.bind(DTUIMessages.database_producer_page_input_objects_node_select_source, pipe.getConsumer().getObjectName()), rootNode, lastSelection, new Class[] { DBSObjectContainer.class, DBSDataContainer.class }, new Class[] { chooseConsumer ? DBSDataManipulator.class : DBSDataContainer.class }, null);
if (node instanceof DBNDatabaseNode) {
lastSelection = (DBNDatabaseNode) node;
DBSObject object = ((DBNDatabaseNode) node).getObject();
if (chooseConsumer) {
if (object instanceof DBSDataManipulator) {
pipe.setConsumer(new DatabaseTransferConsumer((DBSDataManipulator) object));
}
} else {
if (object instanceof DBSDataContainer) {
pipe.setProducer(new DatabaseTransferProducer((DBSDataContainer) object));
}
}
return true;
}
return false;
}
Aggregations