Search in sources :

Example 16 with DataTransferSettings

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;
}
Also used : DataTransferSettings(org.jkiss.dbeaver.tools.transfer.DataTransferSettings) DBNNode(org.jkiss.dbeaver.model.navigator.DBNNode) DBSObjectContainer(org.jkiss.dbeaver.model.struct.DBSObjectContainer) DBNDatabaseNode(org.jkiss.dbeaver.model.navigator.DBNDatabaseNode) DBNModel(org.jkiss.dbeaver.model.navigator.DBNModel)

Example 17 with DataTransferSettings

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);
}
Also used : DataTransferSettings(org.jkiss.dbeaver.tools.transfer.DataTransferSettings) DBSObject(org.jkiss.dbeaver.model.struct.DBSObject) ArrayList(java.util.ArrayList) DataTransferNodeDescriptor(org.jkiss.dbeaver.tools.transfer.registry.DataTransferNodeDescriptor) DataTransferProcessorDescriptor(org.jkiss.dbeaver.tools.transfer.registry.DataTransferProcessorDescriptor)

Example 18 with DataTransferSettings

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;
}
Also used : DataTransferSettings(org.jkiss.dbeaver.tools.transfer.DataTransferSettings) DBNNode(org.jkiss.dbeaver.model.navigator.DBNNode) DBSObjectContainer(org.jkiss.dbeaver.model.struct.DBSObjectContainer) DBNDatabaseNode(org.jkiss.dbeaver.model.navigator.DBNDatabaseNode) DBNModel(org.jkiss.dbeaver.model.navigator.DBNModel)

Example 19 with DataTransferSettings

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());
    }
}
Also used : DataTransferSettings(org.jkiss.dbeaver.tools.transfer.DataTransferSettings)

Example 20 with DataTransferSettings

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;
}
Also used : DataTransferSettings(org.jkiss.dbeaver.tools.transfer.DataTransferSettings) DBSObject(org.jkiss.dbeaver.model.struct.DBSObject) DatabaseTransferConsumer(org.jkiss.dbeaver.tools.transfer.database.DatabaseTransferConsumer) DBNNode(org.jkiss.dbeaver.model.navigator.DBNNode) DBSDataManipulator(org.jkiss.dbeaver.model.struct.DBSDataManipulator) DatabaseTransferProducer(org.jkiss.dbeaver.tools.transfer.database.DatabaseTransferProducer) DBSDataContainer(org.jkiss.dbeaver.model.struct.DBSDataContainer) DBNDatabaseNode(org.jkiss.dbeaver.model.navigator.DBNDatabaseNode) DBNModel(org.jkiss.dbeaver.model.navigator.DBNModel)

Aggregations

DataTransferSettings (org.jkiss.dbeaver.tools.transfer.DataTransferSettings)22 DataTransferPipe (org.jkiss.dbeaver.tools.transfer.DataTransferPipe)8 DBSObject (org.jkiss.dbeaver.model.struct.DBSObject)6 ArrayList (java.util.ArrayList)4 GridData (org.eclipse.swt.layout.GridData)4 DBNDatabaseNode (org.jkiss.dbeaver.model.navigator.DBNDatabaseNode)4 DBNModel (org.jkiss.dbeaver.model.navigator.DBNModel)4 DBNNode (org.jkiss.dbeaver.model.navigator.DBNNode)4 DataTransferNodeDescriptor (org.jkiss.dbeaver.tools.transfer.registry.DataTransferNodeDescriptor)4 DataTransferProcessorDescriptor (org.jkiss.dbeaver.tools.transfer.registry.DataTransferProcessorDescriptor)4 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 SashForm (org.eclipse.swt.custom.SashForm)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 FillLayout (org.eclipse.swt.layout.FillLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 DBException (org.jkiss.dbeaver.DBException)2 DBSDataContainer (org.jkiss.dbeaver.model.struct.DBSDataContainer)2 DBSDataManipulator (org.jkiss.dbeaver.model.struct.DBSDataManipulator)2 DBSObjectContainer (org.jkiss.dbeaver.model.struct.DBSObjectContainer)2