Search in sources :

Example 1 with DebugConfigurationPanelDescriptor

use of org.jkiss.dbeaver.debug.ui.internal.DebugConfigurationPanelDescriptor in project dbeaver by serge-rider.

the class DatabaseDebugConfigurationTab method loadConnectionDebugTypes.

private void loadConnectionDebugTypes() {
    for (Control c : typesGroup.getChildren()) {
        c.dispose();
    }
    DBPDataSourceContainer dataSource = connectionCombo.getSelectedItem();
    if (dataSource == null) {
        UIUtils.createInfoLabel(typesGroup, "Select a connection to see available debug types");
    } else {
        List<DebugConfigurationPanelDescriptor> panels = DebugConfigurationPanelRegistry.getInstance().getPanels(dataSource);
        if (CommonUtils.isEmpty(panels)) {
            UIUtils.createInfoLabel(typesGroup, "Driver '" + dataSource.getDriver().getFullName() + "' doesn't support debugging");
        } else {
            for (DebugConfigurationPanelDescriptor panel : panels) {
                Button typeSelector = new Button(typesGroup, SWT.RADIO);
                typeSelector.setText(panel.getName());
                if (!CommonUtils.isEmpty(panel.getDescription())) {
                    typeSelector.setToolTipText(panel.getDescription());
                }
                typeSelector.setData(panel);
                if (panel.isValid()) {
                    typeSelector.addSelectionListener(new SelectionAdapter() {

                        @Override
                        public void widgetSelected(SelectionEvent e) {
                            if (typeSelector.getSelection()) {
                                setDirty(true);
                                setDebugType(connectionCombo.getSelectedItem(), (DebugConfigurationPanelDescriptor) typeSelector.getData());
                                typesGroup.getParent().layout(true, true);
                            }
                        }
                    });
                } else {
                    typeSelector.setEnabled(false);
                }
            }
        }
    }
    setDebugType(dataSource, null);
    typesGroup.getParent().layout(true, true);
}
Also used : DebugConfigurationPanelDescriptor(org.jkiss.dbeaver.debug.ui.internal.DebugConfigurationPanelDescriptor) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) DBPDataSourceContainer(org.jkiss.dbeaver.model.DBPDataSourceContainer)

Example 2 with DebugConfigurationPanelDescriptor

use of org.jkiss.dbeaver.debug.ui.internal.DebugConfigurationPanelDescriptor in project dbeaver by serge-rider.

the class DatabaseDebugConfigurationTab method initializeFrom.

@Override
public void initializeFrom(ILaunchConfiguration configuration) {
    this.currentConfiguration = configuration;
    try {
        DBPDataSourceContainer dataSource = null;
        try {
            dataSource = DebugUtils.getDataSourceContainer(configuration);
        } catch (CoreException e) {
            log.debug(e);
        }
        connectionCombo.select(dataSource);
        if (dataSource != null) {
            driverText.setText(dataSource.getDriver().getFullName());
        } else {
            driverText.setText("");
        }
        loadConnectionDebugTypes();
        String typeId = configuration.getAttribute(DBGConstants.ATTR_DEBUG_TYPE, (String) null);
        DebugConfigurationPanelDescriptor savedPanel = null;
        if (typeId != null) {
            savedPanel = DebugConfigurationPanelRegistry.getInstance().getPanel(typeId);
            if (savedPanel == null) {
                setWarningMessage("Debug type '" + typeId + "' cannot be resolved");
            }
        }
        setDebugType(dataSource, savedPanel);
    } catch (CoreException e) {
        setWarningMessage("Error loading debug configuration: " + e.getMessage());
    }
    scheduleUpdateJob();
}
Also used : DebugConfigurationPanelDescriptor(org.jkiss.dbeaver.debug.ui.internal.DebugConfigurationPanelDescriptor) CoreException(org.eclipse.core.runtime.CoreException) DBPDataSourceContainer(org.jkiss.dbeaver.model.DBPDataSourceContainer)

Aggregations

DebugConfigurationPanelDescriptor (org.jkiss.dbeaver.debug.ui.internal.DebugConfigurationPanelDescriptor)2 DBPDataSourceContainer (org.jkiss.dbeaver.model.DBPDataSourceContainer)2 CoreException (org.eclipse.core.runtime.CoreException)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1