提交 ba3131b7 编写于 作者: J jurgen

DataSource properties redesign

Former-commit-id: e15d561e
上级 a9a5b0a2
......@@ -279,6 +279,7 @@ meta.org.jkiss.dbeaver.registry.DataSourceDescriptor.propertyServerName.name=Ser
meta.org.jkiss.dbeaver.registry.DataSourceDescriptor.propertyDriver.name=Driver
meta.org.jkiss.dbeaver.registry.DataSourceDescriptor.propertyConnectTime.name=Connect Time
meta.org.jkiss.dbeaver.registry.DataSourceDescriptor.propertyConnectType.name=Connect Type
meta.org.jkiss.dbeaver.registry.DataSourceDescriptor$ContextInfo.name.name=Context Name
meta.org.jkiss.dbeaver.registry.DriverDescriptor.category.name=Driver Category
meta.org.jkiss.dbeaver.registry.DriverDescriptor.name.name=Driver Name
meta.org.jkiss.dbeaver.registry.DriverDescriptor.description.name=Description
......
......@@ -23,6 +23,7 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.ISaveablePart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.views.properties.IPropertySource;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
......@@ -56,6 +57,7 @@ import org.jkiss.dbeaver.ui.actions.DataSourcePropertyTester;
import org.jkiss.dbeaver.ui.dialogs.ConfirmationDialog;
import org.jkiss.dbeaver.ui.dialogs.connection.EditConnectionDialog;
import org.jkiss.dbeaver.ui.dialogs.connection.EditConnectionWizard;
import org.jkiss.dbeaver.ui.properties.PropertyCollector;
import org.jkiss.dbeaver.utils.AbstractPreferenceStore;
import org.jkiss.utils.CommonUtils;
......@@ -249,7 +251,6 @@ public class DataSourceDescriptor
@Nullable
@Override
@Property(order = 100)
public String getDescription()
{
return description;
......@@ -1011,6 +1012,17 @@ public class DataSourceDescriptor
{
if (DBSDataSourceContainer.class.isAssignableFrom(adapter)) {
return this;
} else if (adapter == IPropertySource.class) {
PropertyCollector coll = new PropertyCollector(this, true);
coll.collectProperties();
if (dataSource != null) {
int conIndex = 0;
for (DBCExecutionContext context : dataSource.getAllContexts()) {
conIndex++;
coll.addProperty("Connections", conIndex, String.valueOf(conIndex), new ContextInfo(context));
}
}
return coll;
}
return null;
}
......@@ -1051,13 +1063,13 @@ public class DataSourceDescriptor
DataSourcePropertyTester.firePropertyChange(DataSourcePropertyTester.PROP_TRANSACTIONAL);
}
@Property(viewable = true, order = 2)
@Property(viewable = true, order = 2, category = "Driver")
public String getPropertyDriverType()
{
return driver.getName();
}
@Property(order = 3)
@Property(order = 3, category = "Server")
public String getPropertyAddress()
{
StringBuilder addr = new StringBuilder();
......@@ -1070,20 +1082,20 @@ public class DataSourceDescriptor
return addr.toString();
}
@Property(order = 4)
@Property(order = 4, category = "Server")
public String getPropertyDatabase()
{
return connectionInfo.getDatabaseName();
}
@Property(order = 5)
@Property(order = 5, category = "Server")
public String getPropertyURL()
{
return connectionInfo.getUrl();
}
@Nullable
@Property(order = 6)
@Property(order = 6, category = "Server")
public String getPropertyServerName()
{
if (dataSource != null) {
......@@ -1097,7 +1109,7 @@ public class DataSourceDescriptor
}
@Nullable
@Property(order = 7)
@Property(order = 7, category = "Driver")
public String getPropertyDriver()
{
if (dataSource != null) {
......@@ -1204,4 +1216,22 @@ public class DataSourceDescriptor
}
}
public static class ContextInfo implements DBPObject {
private final DBCExecutionContext context;
public ContextInfo(DBCExecutionContext context) {
this.context = context;
}
@Property(viewable = true, order = 1)
public String getName() {
return context.getContextName();
}
@Override
public String toString() {
return getName();
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册