提交 01ac41cd 编写于 作者: J jurgen

Maven artifact update

上级 11d20176
......@@ -25,10 +25,7 @@ import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.*;
import org.jkiss.dbeaver.core.DBeaverUI;
import org.jkiss.dbeaver.model.DBPDriverFile;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
......@@ -60,22 +57,35 @@ class DriverDownloadAutoPage extends DriverDownloadPage {
final DriverDescriptor driver = wizard.getDriver();
setMessage("Download " + driver.getFullName() + " driver files");
StringBuilder message = new StringBuilder();
message.append("").append(driver.getFullName())
.append(" driver files are missing.\nDBeaver can download these files automatically.\n\nFiles required by driver:");
for (DriverFileDescriptor file : wizard.getFiles()) {
message.append("\n\t-").append(file.getPath());
}
message.append("\n\nOr you can obtain driver files by yourself and add them in driver editor.");
initializeDialogUnits(parent);
Composite composite = UIUtils.createPlaceholder(parent, 1);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
Text infoText = new Text(composite, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP);
infoText.setText(message.toString());
infoText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
if (!wizard.isForceDownload()) {
Label infoText = new Label(composite, SWT.NONE);
infoText.setText(driver.getFullName() + " driver files are missing.\nDBeaver can download these files automatically.\n\n");
infoText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
{
Group filesGroup = UIUtils.createControlGroup(composite, "Files required by driver", 1, -1, -1);
filesGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Table filesTable = new Table(filesGroup, SWT.BORDER | SWT.FULL_SELECTION);
filesTable.setHeaderVisible(true);
filesTable.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
UIUtils.createTableColumn(filesTable, SWT.LEFT, "File");
for (DriverFileDescriptor file : wizard.getFiles()) {
new TableItem(filesTable, SWT.NONE).setText(file.getPath());
}
UIUtils.packColumns(filesTable, true);
}
if (!wizard.isForceDownload()) {
Label infoText = new Label(composite, SWT.NONE);
infoText.setText("\n\nOr you can obtain driver files by yourself and add them in driver editor.");
infoText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
createLinksPanel(composite);
......
......@@ -21,6 +21,7 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchWindow;
import org.jkiss.dbeaver.core.DBeaverUI;
......@@ -28,6 +29,7 @@ import org.jkiss.dbeaver.registry.DriverDescriptor;
import org.jkiss.dbeaver.registry.DriverFileDescriptor;
import org.jkiss.dbeaver.ui.DBeaverIcons;
import org.jkiss.dbeaver.ui.UIIcon;
import org.jkiss.dbeaver.ui.UIUtils;
import java.util.List;
......@@ -40,9 +42,9 @@ public class DriverDownloadDialog extends WizardDialog
private boolean doDownload = false;
DriverDownloadDialog(Shell shell, DriverDescriptor driver, List<DriverFileDescriptor> files)
DriverDownloadDialog(Shell shell, DriverDescriptor driver, List<DriverFileDescriptor> files, boolean forceDownload)
{
super(shell, new DriverDownloadWizard(driver, files));
super(shell, new DriverDownloadWizard(driver, files, forceDownload));
}
DriverDescriptor getDriver() {
......@@ -54,12 +56,27 @@ public class DriverDownloadDialog extends WizardDialog
return (DriverDownloadWizard)super.getWizard();
}
@Override
protected Control createDialogArea(Composite parent) {
Control dialogArea = super.createDialogArea(parent);
if (getWizard().isForceDownload()) {
UIUtils.runInDetachedUI(getShell(), new Runnable() {
@Override
public void run() {
buttonPressed(IDialogConstants.FINISH_ID);
}
});
}
return dialogArea;
}
@Override
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, EDIT_DRIVER_BUTTON_ID, "Edit Driver", false);
if (!getWizard().isForceDownload()) {
createButton(parent, EDIT_DRIVER_BUTTON_ID, "Edit Driver", false);
}
super.createButtonsForButtonBar(parent);
parent.layout();
}
@Override
......@@ -85,14 +102,20 @@ public class DriverDownloadDialog extends WizardDialog
@Override
protected void finishPressed() {
getButton(EDIT_DRIVER_BUTTON_ID).setEnabled(false);
Button editButton = getButton(EDIT_DRIVER_BUTTON_ID);
if (editButton != null) {
editButton.setEnabled(false);
}
doDownload = true;
super.finishPressed();
}
public static boolean downloadDriverFiles(Shell shell, DriverDescriptor driver, List<DriverFileDescriptor> files) {
DriverDownloadDialog dialog = new DriverDownloadDialog(shell, driver, files);
//dialog.setPageSize(1,1);
return downloadDriverFiles(shell, driver, files, false);
}
public static boolean downloadDriverFiles(Shell shell, DriverDescriptor driver, List<DriverFileDescriptor> files, boolean forceDownload) {
DriverDownloadDialog dialog = new DriverDownloadDialog(shell, driver, files, forceDownload);
dialog.open();
return dialog.doDownload;
}
......
......@@ -36,11 +36,13 @@ public class DriverDownloadWizard extends Wizard implements IExportWizard {
private DriverDescriptor driver;
private List<DriverFileDescriptor> files;
private boolean forceDownload;
private DriverDownloadPage downloadPage;
public DriverDownloadWizard(@NotNull DriverDescriptor driver, List<DriverFileDescriptor> files) {
public DriverDownloadWizard(@NotNull DriverDescriptor driver, List<DriverFileDescriptor> files, boolean forceDownload) {
this.driver = driver;
this.files = files;
this.forceDownload = forceDownload;
setWindowTitle("Setup driver files");
setNeedsProgressMonitor(hasPredefinedFiles());
loadSettings();
......@@ -54,6 +56,10 @@ public class DriverDownloadWizard extends Wizard implements IExportWizard {
return files;
}
public boolean isForceDownload() {
return forceDownload;
}
private void loadSettings()
{
IDialogSettings section = UIUtils.getDialogSettings(DRIVER_DOWNLOAD_DIALOG_SETTINGS);
......
......@@ -437,6 +437,14 @@ public class DriverEditDialog extends HelpEnabledDialog
}
});
updateVersionButton = UIUtils.createToolButton(libsControlGroup, CoreMessages.dialog_edit_driver_button_update_version, new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
DriverFileDescriptor selectedLib = getSelectedLibrary();
updateArtifactVersion(selectedLib);
}
});
deleteButton = UIUtils.createToolButton(libsControlGroup, CoreMessages.dialog_edit_driver_button_delete, new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e)
......@@ -483,13 +491,6 @@ public class DriverEditDialog extends HelpEnabledDialog
cpDialog.open();
}
});
updateVersionButton = UIUtils.createToolButton(libsControlGroup, CoreMessages.dialog_edit_driver_button_update_version, new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
DriverFileDescriptor selectedLib = getSelectedLibrary();
updateArtifactVersion(selectedLib);
}
});
changeLibContent();
......@@ -500,7 +501,7 @@ public class DriverEditDialog extends HelpEnabledDialog
}
private void updateArtifactVersion(DriverFileDescriptor lib) {
DriverDownloadDialog.downloadDriverFiles(getShell(), driver, Collections.singletonList(lib), true);
}
private void createParametersTab(TabFolder group)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册