use of org.jkiss.dbeaver.ui.dialogs.BaseDialog in project dbeaver by dbeaver.
the class DriverManagerDialog method undeleteDrivers.
private boolean undeleteDrivers() {
List<DriverDescriptor> drivers = new ArrayList<>();
BaseDialog dialog = new BaseDialog(getShell(), "Restore deleted driver(s)", null) {
@Override
protected Composite createDialogArea(Composite parent) {
final Composite composite = super.createDialogArea(parent);
Table driverTable = new Table(composite, SWT.CHECK | SWT.FULL_SELECTION | SWT.BORDER);
driverTable.setLayoutData(new GridData(GridData.FILL_BOTH));
for (DBPDataSourceProviderDescriptor dspd : DataSourceProviderRegistry.getInstance().getEnabledDataSourceProviders()) {
for (DBPDriver dd : dspd.getDrivers()) {
if (dd.isDisabled()) {
TableItem item = new TableItem(driverTable, SWT.NONE);
item.setImage(DBeaverIcons.getImage(dd.getIcon()));
item.setText(dd.getName());
item.setData(dd);
}
}
}
driverTable.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (((TableItem) e.item).getChecked()) {
drivers.add((DriverDescriptor) e.item.getData());
} else {
drivers.remove((DriverDescriptor) e.item.getData());
}
}
});
return super.createDialogArea(parent);
}
};
if (dialog.open() == IDialogConstants.OK_ID) {
for (DriverDescriptor dd : drivers) {
dd.setDisabled(false);
dd.getProviderDescriptor().getRegistry().saveDrivers();
}
return true;
}
return false;
}
use of org.jkiss.dbeaver.ui.dialogs.BaseDialog in project dbeaver by serge-rider.
the class DriverManagerDialog method undeleteDrivers.
private boolean undeleteDrivers() {
List<DriverDescriptor> drivers = new ArrayList<>();
BaseDialog dialog = new BaseDialog(getShell(), "Restore deleted driver(s)", null) {
@Override
protected Composite createDialogArea(Composite parent) {
final Composite composite = super.createDialogArea(parent);
Table driverTable = new Table(composite, SWT.CHECK | SWT.FULL_SELECTION | SWT.BORDER);
driverTable.setLayoutData(new GridData(GridData.FILL_BOTH));
for (DBPDataSourceProviderDescriptor dspd : DataSourceProviderRegistry.getInstance().getEnabledDataSourceProviders()) {
for (DBPDriver dd : dspd.getDrivers()) {
if (dd.isDisabled()) {
TableItem item = new TableItem(driverTable, SWT.NONE);
item.setImage(DBeaverIcons.getImage(dd.getIcon()));
item.setText(dd.getName());
item.setData(dd);
}
}
}
driverTable.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (((TableItem) e.item).getChecked()) {
drivers.add((DriverDescriptor) e.item.getData());
} else {
drivers.remove((DriverDescriptor) e.item.getData());
}
}
});
return super.createDialogArea(parent);
}
};
if (dialog.open() == IDialogConstants.OK_ID) {
for (DriverDescriptor dd : drivers) {
dd.setDisabled(false);
dd.getProviderDescriptor().getRegistry().saveDrivers();
}
return true;
}
return false;
}
Aggregations