Search in sources :

Example 1 with DashboardViewConfiguration

use of org.jkiss.dbeaver.ui.dashboard.model.DashboardViewConfiguration in project dbeaver by serge-rider.

the class DashboardView method createDashboardControls.

private void createDashboardControls(Composite parent) {
    try {
        String secondaryId = getViewSite().getSecondaryId();
        if (CommonUtils.isEmpty(secondaryId)) {
            throw new IllegalStateException("Dashboard view requires active database connection");
        }
        String projectName, dsId;
        int divPos = secondaryId.indexOf("/");
        if (divPos == -1) {
            projectName = null;
            dsId = secondaryId;
        } else {
            projectName = secondaryId.substring(0, divPos);
            dsId = secondaryId.substring(divPos + 1);
        }
        dataSourceContainer = DBUtils.findDataSource(projectName, dsId);
        if (dataSourceContainer == null) {
            throw new IllegalStateException("Database connection '" + dsId + "' not found");
        }
        dataSourceContainer.getRegistry().addDataSourceListener(this);
        configuration = new DashboardViewConfiguration(dataSourceContainer, secondaryId);
        dashboardListViewer = new DashboardListViewer(getSite(), dataSourceContainer, configuration);
        dashboardListViewer.createControl(parent);
        dashboardListViewer.createDashboardsFromConfiguration();
        getSite().setSelectionProvider(dashboardListViewer);
        parent.layout(true, true);
        updateStatus();
    } catch (Throwable e) {
        log.error("Error initializing dashboard view", e);
    }
}
Also used : DashboardViewConfiguration(org.jkiss.dbeaver.ui.dashboard.model.DashboardViewConfiguration) DashboardListViewer(org.jkiss.dbeaver.ui.dashboard.control.DashboardListViewer)

Example 2 with DashboardViewConfiguration

use of org.jkiss.dbeaver.ui.dashboard.model.DashboardViewConfiguration in project dbeaver by dbeaver.

the class DashboardView method createDashboardControls.

private void createDashboardControls(Composite parent) {
    try {
        String secondaryId = getViewSite().getSecondaryId();
        if (CommonUtils.isEmpty(secondaryId)) {
            throw new IllegalStateException("Dashboard view requires active database connection");
        }
        String projectName, dsId;
        int divPos = secondaryId.indexOf("/");
        if (divPos == -1) {
            projectName = null;
            dsId = secondaryId;
        } else {
            projectName = secondaryId.substring(0, divPos);
            dsId = secondaryId.substring(divPos + 1);
        }
        dataSourceContainer = DBUtils.findDataSource(projectName, dsId);
        if (dataSourceContainer == null) {
            throw new IllegalStateException("Database connection '" + dsId + "' not found");
        }
        dataSourceContainer.getRegistry().addDataSourceListener(this);
        configuration = new DashboardViewConfiguration(dataSourceContainer, secondaryId);
        dashboardListViewer = new DashboardListViewer(getSite(), dataSourceContainer, configuration);
        dashboardListViewer.createControl(parent);
        dashboardListViewer.createDashboardsFromConfiguration();
        getSite().setSelectionProvider(dashboardListViewer);
        parent.layout(true, true);
        updateStatus();
    } catch (Throwable e) {
        log.error("Error initializing dashboard view", e);
    }
}
Also used : DashboardViewConfiguration(org.jkiss.dbeaver.ui.dashboard.model.DashboardViewConfiguration) DashboardListViewer(org.jkiss.dbeaver.ui.dashboard.control.DashboardListViewer)

Aggregations

DashboardListViewer (org.jkiss.dbeaver.ui.dashboard.control.DashboardListViewer)2 DashboardViewConfiguration (org.jkiss.dbeaver.ui.dashboard.model.DashboardViewConfiguration)2