use of org.jkiss.dbeaver.ui.dialogs.driver.DriverSelectViewer in project dbeaver by serge-rider.
the class ConfigImportWizardPageCustomDriver method createControl.
@Override
public void createControl(Composite parent) {
Composite placeholder = new Composite(parent, SWT.NONE);
placeholder.setLayout(new GridLayout(1, true));
DriverSelectViewer driverSelectViewer = new DriverSelectViewer(placeholder, this, DataSourceProviderRegistry.getInstance().getEnabledDataSourceProviders(), true);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 200;
driverSelectViewer.getControl().setLayoutData(gd);
setControl(placeholder);
}
use of org.jkiss.dbeaver.ui.dialogs.driver.DriverSelectViewer in project dbeaver by dbeaver.
the class ConnectionPageDriver method createControl.
@Override
public void createControl(Composite parent) {
Composite placeholder = UIUtils.createComposite(parent, 1);
{
driverSelectViewer = new DriverSelectViewer(placeholder, this, wizard.getAvailableProvides(), true);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 200;
driverSelectViewer.getControl().setLayoutData(gd);
}
setControl(placeholder);
Composite controlsGroup = UIUtils.createComposite(placeholder, 5);
controlsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// Navigator view preset
{
Composite presetComposite = new Composite(controlsGroup, SWT.NONE);
presetComposite.setLayout(new RowLayout());
new Label(presetComposite, SWT.NONE).setImage(DBeaverIcons.getImage(UIIcon.CONFIGURATION));
new Label(presetComposite, SWT.NONE).setText("Connection view: ");
for (DataSourceNavigatorSettings.Preset p : DataSourceNavigatorSettings.PRESETS.values()) {
if (p != DataSourceNavigatorSettings.PRESET_CUSTOM) {
Button pButton = new Button(presetComposite, SWT.RADIO);
pButton.setText(p.getName());
pButton.setToolTipText(p.getDescription());
if (p == navigatorPreset) {
pButton.setSelection(true);
}
pButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (pButton.getSelection()) {
navigatorPreset = p;
DBeaverActivator.getInstance().getPreferences().setValue(DEFAULT_NAVIGATOR_SETTINGS_RESET, navigatorPreset.getId());
}
}
});
}
}
}
{
// Spacer
new Label(controlsGroup, SWT.NONE).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
{
// Sorter
Composite orderGroup = new Composite(controlsGroup, SWT.NONE);
orderGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
orderGroup.setLayout(new RowLayout());
new Label(orderGroup, SWT.NONE).setImage(DBeaverIcons.getImage(UIIcon.SORT));
new Label(orderGroup, SWT.NONE).setText("Sort by: ");
for (DriverSelectViewer.OrderBy ob : DriverSelectViewer.OrderBy.values()) {
Button obScoreButton = new Button(orderGroup, SWT.RADIO);
obScoreButton.setText(ob.getLabel());
obScoreButton.setToolTipText(ob.getDescription());
obScoreButton.setData(ob);
if (ob == driverSelectViewer.getOrderBy()) {
obScoreButton.setSelection(true);
}
obScoreButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
driverSelectViewer.setOrderBy((DriverSelectViewer.OrderBy) obScoreButton.getData());
}
});
}
}
{
// Spacer
new Label(controlsGroup, SWT.NONE).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
final List<DBPProject> projects = DBWorkbench.getPlatform().getWorkspace().getProjects();
if (projects.size() == 1) {
if (connectionProject == null) {
connectionProject = projects.get(0);
}
} else if (projects.size() > 1) {
Composite projectGroup = UIUtils.createComposite(controlsGroup, 3);
projectGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
new Label(projectGroup, SWT.NONE).setImage(DBeaverIcons.getImage(DBIcon.PROJECT));
UIUtils.createControlLabel(projectGroup, CoreMessages.dialog_connection_driver_project);
final Combo projectCombo = new Combo(projectGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
projectCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
for (DBPProject project : projects) {
projectCombo.add(project.getName());
}
if (connectionProject == null) {
projectCombo.select(0);
connectionProject = projects.get(0);
} else {
projectCombo.setText(connectionProject.getName());
}
projectCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
connectionProject = projects.get(projectCombo.getSelectionIndex());
}
});
if (projects.size() < 2) {
// projectCombo.setEnabled(false);
}
} else {
setErrorMessage("You need to create a project first");
}
UIUtils.setHelp(placeholder, IHelpContextIds.CTX_CON_WIZARD_DRIVER);
}
use of org.jkiss.dbeaver.ui.dialogs.driver.DriverSelectViewer in project dbeaver by dbeaver.
the class ConfigImportWizardPageNavicatDriver method createControl.
@Override
public void createControl(Composite parent) {
Composite placeholder = new Composite(parent, SWT.NONE);
placeholder.setLayout(new GridLayout(1, true));
DriverSelectViewer driverSelectViewer = new DriverSelectViewer(placeholder, this, DataSourceProviderRegistry.getInstance().getEnabledDataSourceProviders(), true);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 200;
driverSelectViewer.getControl().setLayoutData(gd);
setControl(placeholder);
}
use of org.jkiss.dbeaver.ui.dialogs.driver.DriverSelectViewer in project dbeaver by dbeaver.
the class ConfigImportWizardPageCustomDriver method createControl.
@Override
public void createControl(Composite parent) {
Composite placeholder = new Composite(parent, SWT.NONE);
placeholder.setLayout(new GridLayout(1, true));
DriverSelectViewer driverSelectViewer = new DriverSelectViewer(placeholder, this, DataSourceProviderRegistry.getInstance().getEnabledDataSourceProviders(), true);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 200;
driverSelectViewer.getControl().setLayoutData(gd);
setControl(placeholder);
}
use of org.jkiss.dbeaver.ui.dialogs.driver.DriverSelectViewer in project dbeaver by serge-rider.
the class ConnectionPageDriver method createControl.
@Override
public void createControl(Composite parent) {
Composite placeholder = UIUtils.createComposite(parent, 1);
{
driverSelectViewer = new DriverSelectViewer(placeholder, this, wizard.getAvailableProvides(), true);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 200;
driverSelectViewer.getControl().setLayoutData(gd);
}
setControl(placeholder);
Composite controlsGroup = UIUtils.createComposite(placeholder, 5);
controlsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// Navigator view preset
{
Composite presetComposite = new Composite(controlsGroup, SWT.NONE);
presetComposite.setLayout(new RowLayout());
new Label(presetComposite, SWT.NONE).setImage(DBeaverIcons.getImage(UIIcon.CONFIGURATION));
new Label(presetComposite, SWT.NONE).setText("Connection view: ");
for (DataSourceNavigatorSettings.Preset p : DataSourceNavigatorSettings.PRESETS.values()) {
if (p != DataSourceNavigatorSettings.PRESET_CUSTOM) {
Button pButton = new Button(presetComposite, SWT.RADIO);
pButton.setText(p.getName());
pButton.setToolTipText(p.getDescription());
if (p == navigatorPreset) {
pButton.setSelection(true);
}
pButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (pButton.getSelection()) {
navigatorPreset = p;
DBeaverActivator.getInstance().getPreferences().setValue(DEFAULT_NAVIGATOR_SETTINGS_RESET, navigatorPreset.getId());
}
}
});
}
}
}
{
// Spacer
new Label(controlsGroup, SWT.NONE).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
{
// Sorter
Composite orderGroup = new Composite(controlsGroup, SWT.NONE);
orderGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
orderGroup.setLayout(new RowLayout());
new Label(orderGroup, SWT.NONE).setImage(DBeaverIcons.getImage(UIIcon.SORT));
new Label(orderGroup, SWT.NONE).setText("Sort by: ");
for (DriverSelectViewer.OrderBy ob : DriverSelectViewer.OrderBy.values()) {
Button obScoreButton = new Button(orderGroup, SWT.RADIO);
obScoreButton.setText(ob.getLabel());
obScoreButton.setToolTipText(ob.getDescription());
obScoreButton.setData(ob);
if (ob == driverSelectViewer.getOrderBy()) {
obScoreButton.setSelection(true);
}
obScoreButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
driverSelectViewer.setOrderBy((DriverSelectViewer.OrderBy) obScoreButton.getData());
}
});
}
}
{
// Spacer
new Label(controlsGroup, SWT.NONE).setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
final List<DBPProject> projects = DBWorkbench.getPlatform().getWorkspace().getProjects();
if (projects.size() == 1) {
if (connectionProject == null) {
connectionProject = projects.get(0);
}
} else if (projects.size() > 1) {
Composite projectGroup = UIUtils.createComposite(controlsGroup, 3);
projectGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
new Label(projectGroup, SWT.NONE).setImage(DBeaverIcons.getImage(DBIcon.PROJECT));
UIUtils.createControlLabel(projectGroup, CoreMessages.dialog_connection_driver_project);
final Combo projectCombo = new Combo(projectGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
projectCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
for (DBPProject project : projects) {
projectCombo.add(project.getName());
}
if (connectionProject == null) {
projectCombo.select(0);
connectionProject = projects.get(0);
} else {
projectCombo.setText(connectionProject.getName());
}
projectCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
connectionProject = projects.get(projectCombo.getSelectionIndex());
}
});
if (projects.size() < 2) {
// projectCombo.setEnabled(false);
}
} else {
setErrorMessage("You need to create a project first");
}
UIUtils.setHelp(placeholder, IHelpContextIds.CTX_CON_WIZARD_DRIVER);
}
Aggregations