diff --git a/plugins/org.jkiss.dbeaver.core/plugin.properties b/plugins/org.jkiss.dbeaver.core/plugin.properties index 1845525d2e3f2f3f8630e1f04eae4c102726ecdb..3de8d93f8420797b1b79e09a3d70cf3ddc7efe9a 100644 --- a/plugins/org.jkiss.dbeaver.core/plugin.properties +++ b/plugins/org.jkiss.dbeaver.core/plugin.properties @@ -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 diff --git a/plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DataSourceDescriptor.java b/plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DataSourceDescriptor.java index 0b034f689e1e8429afb28337979e74a763f5b704..4301c091bf524021b7ed607f7f1cabb3d5af4ed5 100644 --- a/plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DataSourceDescriptor.java +++ b/plugins/org.jkiss.dbeaver.core/src/org/jkiss/dbeaver/registry/DataSourceDescriptor.java @@ -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(); + } + } + }