提交 b91599bd 编写于 作者: J jurgen

Driver download UI

Former-commit-id: 0efb9a11
上级 ddf293b3
......@@ -965,6 +965,10 @@ public class DriverDescriptor extends AbstractDescriptor implements DBPDriver
return result;
}
public boolean isLibraryResolved(DBPDriverLibrary library) {
return !library.isDownloadable() || !CommonUtils.isEmpty(resolvedFiles.get(library));
}
private void collectLibraryFiles(DBPDriverDependencies.DependencyNode node, List<DriverFileInfo> files) {
if (node.duplicate) {
return;
......
......@@ -52,11 +52,6 @@ public class DriverLibraryLocal extends DriverLibraryAbstract
return false;
}
@Override
public boolean isResolved() {
return true;
}
@Override
public void resetVersion() {
// do nothing
......
......@@ -59,6 +59,9 @@ public class DriverLibraryMavenArtifact extends DriverLibraryAbstract
@Override
public String getDescription()
{
if (localVersion != null) {
return localVersion.getDescription();
}
return null;
}
......@@ -68,11 +71,6 @@ public class DriverLibraryMavenArtifact extends DriverLibraryAbstract
return true;
}
@Override
public boolean isResolved() {
return localVersion != null;
}
@Override
public void resetVersion() {
this.localVersion = null;
......
......@@ -39,11 +39,6 @@ public class DriverLibraryMavenDependency extends DriverLibraryMavenArtifact
this.source = source;
}
@Override
public boolean isResolved() {
return true;
}
protected boolean isDependencyExcluded(DBRProgressMonitor monitor, MavenArtifactDependency dependency) {
List<MavenArtifactReference> exclusions = source.getExclusions();
if (exclusions != null) {
......
......@@ -217,6 +217,9 @@ public class MavenArtifactVersion {
url = XMLUtils.getChildElementBody(root, "url");
version = XMLUtils.getChildElementBody(root, "version");
description = XMLUtils.getChildElementBody(root, "description");
if (description != null) {
description = description.trim().replaceAll("\\s+", " ");
}
{
// Parent
Element parentElement = XMLUtils.getChildElement(root, "parent");
......
......@@ -74,6 +74,7 @@ class DriverDownloadAutoPage extends DriverDownloadPage {
filesTree.setLayoutData(new GridData(GridData.FILL_BOTH));
UIUtils.createTreeColumn(filesTree, SWT.LEFT, "File");
UIUtils.createTreeColumn(filesTree, SWT.LEFT, "Version");
UIUtils.createTreeColumn(filesTree, SWT.LEFT, "Description");
}
if (!wizard.isForceDownload()) {
......@@ -110,13 +111,14 @@ class DriverDownloadAutoPage extends DriverDownloadPage {
return;
}
int totalItems = 0;
int totalItems = 1;
for (DBPDriverDependencies.DependencyNode node : getWizard().getDependencies().getLibraryMap()) {
DBPDriverLibrary library = node.library;
TreeItem item = new TreeItem(filesTree, SWT.NONE);
item.setImage(DBeaverIcons.getImage(library.getIcon()));
item.setText(0, library.getDisplayName());
item.setText(1, CommonUtils.notEmpty(library.getVersion()));
item.setText(2, CommonUtils.notEmpty(library.getDescription()));
totalItems++;
if (addDependencies(item, node)) {
item.setExpanded(true);
......@@ -141,6 +143,7 @@ class DriverDownloadAutoPage extends DriverDownloadPage {
item.setImage(DBeaverIcons.getImage(dep.library.getIcon()));
item.setText(0, dep.library.getDisplayName());
item.setText(1, CommonUtils.notEmpty(dep.library.getVersion()));
item.setText(2, CommonUtils.notEmpty(dep.library.getDescription()));
if (dep.duplicate) {
item.setForeground(getShell().getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
......
......@@ -333,7 +333,7 @@ public class DriverEditDialog extends HelpEnabledDialog
File localFile = lib.getLocalFile();
if (localFile != null && localFile.exists()) {
cell.setForeground(null);
} else if (!lib.isResolved()) {
} else if (!driver.isLibraryResolved(lib)) {
cell.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));
} else {
cell.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
......
......@@ -54,7 +54,7 @@ public interface DBPDriverLibrary
String getId();
/**
* Library version. If library doesn;t support versions returns null.
* Library version. If library doesn't support versions returns null.
*/
@Nullable
String getVersion();
......@@ -83,8 +83,6 @@ public interface DBPDriverLibrary
boolean isDownloadable();
boolean isResolved();
@Nullable
String getExternalURL(DBRProgressMonitor monitor);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册