Search in sources :

Example 1 with DBSDataContainer

use of org.jkiss.dbeaver.model.struct.DBSDataContainer 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;
}
Also used : DBSDataContainer(org.jkiss.dbeaver.model.struct.DBSDataContainer) DataTransferPipe(org.jkiss.dbeaver.tools.transfer.wizard.DataTransferPipe)

Example 2 with DBSDataContainer

use of org.jkiss.dbeaver.model.struct.DBSDataContainer in project dbeaver by serge-rider.

the class DataImportHandler method chooseProducer.

@Override
protected IDataTransferProducer chooseProducer(ExecutionEvent event, IDataTransferConsumer consumer) {
    final DBNModel navigatorModel = DBeaverCore.getInstance().getNavigatorModel();
    final DBNNode rootNode = DBeaverCore.getInstance().getLiveProjects().size() == 1 ? navigatorModel.getRoot().getProject(DBeaverCore.getInstance().getProjectRegistry().getActiveProject()) : navigatorModel.getRoot();
    DBNNode node = BrowseObjectDialog.selectObject(HandlerUtil.getActiveShell(event), "Select source container for '" + consumer.getTargetName() + "'", rootNode, null, new Class[] { DBSObjectContainer.class, DBSDataContainer.class }, new Class[] { DBSDataContainer.class });
    if (node instanceof DBNDatabaseNode) {
        DBSObject object = ((DBNDatabaseNode) node).getObject();
        if (object instanceof DBSDataContainer) {
            return new DatabaseTransferProducer((DBSDataContainer) object);
        }
    }
    return null;
}
Also used : DBSObject(org.jkiss.dbeaver.model.struct.DBSObject) DBNNode(org.jkiss.dbeaver.model.navigator.DBNNode) 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)

Example 3 with DBSDataContainer

use of org.jkiss.dbeaver.model.struct.DBSDataContainer in project dbeaver by serge-rider.

the class ResultSetFilterPanel method getActiveQueryText.

@NotNull
private String getActiveQueryText() {
    DBCStatistics statistics = viewer.getModel().getStatistics();
    String queryText = statistics == null ? null : statistics.getQueryText();
    if (queryText == null || queryText.isEmpty()) {
        DBSDataContainer dataContainer = viewer.getDataContainer();
        if (dataContainer != null) {
            return dataContainer.getName();
        }
        queryText = DEFAULT_QUERY_TEXT;
    }
    return queryText;
}
Also used : DBCStatistics(org.jkiss.dbeaver.model.exec.DBCStatistics) DBSDataContainer(org.jkiss.dbeaver.model.struct.DBSDataContainer) NotNull(org.jkiss.code.NotNull)

Example 4 with DBSDataContainer

use of org.jkiss.dbeaver.model.struct.DBSDataContainer in project dbeaver by serge-rider.

the class ResultSetFilterPanel method openEditorForActiveQuery.

private void openEditorForActiveQuery() {
    DBSDataContainer dataContainer = viewer.getDataContainer();
    String editorName;
    if (dataContainer instanceof DBSEntity) {
        editorName = dataContainer.getName();
    } else {
        editorName = "Query";
    }
    OpenHandler.openSQLConsole(DBeaverUI.getActiveWorkbenchWindow(), dataContainer == null ? null : dataContainer.getDataSource().getContainer(), editorName, getActiveQueryText());
}
Also used : DBSEntity(org.jkiss.dbeaver.model.struct.DBSEntity) DBSDataContainer(org.jkiss.dbeaver.model.struct.DBSDataContainer)

Example 5 with DBSDataContainer

use of org.jkiss.dbeaver.model.struct.DBSDataContainer in project dbeaver by serge-rider.

the class ResultSetFilterPanel method getActiveSourceQuery.

@NotNull
private String getActiveSourceQuery() {
    String displayName;
    DBSDataContainer dataContainer = viewer.getDataContainer();
    if (dataContainer != null) {
        displayName = dataContainer.getName();
    } else {
        displayName = getActiveQueryText();
    }
    return displayName;
}
Also used : DBSDataContainer(org.jkiss.dbeaver.model.struct.DBSDataContainer) NotNull(org.jkiss.code.NotNull)

Aggregations

DBSDataContainer (org.jkiss.dbeaver.model.struct.DBSDataContainer)7 NotNull (org.jkiss.code.NotNull)2 DBNDatabaseNode (org.jkiss.dbeaver.model.navigator.DBNDatabaseNode)2 DBNModel (org.jkiss.dbeaver.model.navigator.DBNModel)2 DBException (org.jkiss.dbeaver.DBException)1 DBPDataSource (org.jkiss.dbeaver.model.DBPDataSource)1 DBCStatistics (org.jkiss.dbeaver.model.exec.DBCStatistics)1 DBNNode (org.jkiss.dbeaver.model.navigator.DBNNode)1 DBSEntity (org.jkiss.dbeaver.model.struct.DBSEntity)1 DBSObject (org.jkiss.dbeaver.model.struct.DBSObject)1 DatabaseTransferProducer (org.jkiss.dbeaver.tools.transfer.database.DatabaseTransferProducer)1 DataTransferPipe (org.jkiss.dbeaver.tools.transfer.wizard.DataTransferPipe)1