Search in sources :

Example 16 with PropertyCollector

use of org.jkiss.dbeaver.runtime.properties.PropertyCollector in project dbeaver by serge-rider.

the class DataSourceAuthModelDescriptor method createCredentialsSource.

@NotNull
@Override
public DBPPropertySource createCredentialsSource(DBPDataSourceContainer dataSource, DBPConnectionConfiguration configuration) {
    DBAAuthModel instance = getInstance();
    DBAAuthCredentials credentials = dataSource == null || configuration == null ? instance.createCredentials() : instance.loadCredentials(dataSource, configuration);
    PropertyCollector propertyCollector = new PropertyCollector(credentials, false);
    propertyCollector.collectProperties();
    return propertyCollector;
}
Also used : DBAAuthCredentials(org.jkiss.dbeaver.model.auth.DBAAuthCredentials) PropertyCollector(org.jkiss.dbeaver.runtime.properties.PropertyCollector) DBAAuthModel(org.jkiss.dbeaver.model.auth.DBAAuthModel) NotNull(org.jkiss.code.NotNull)

Example 17 with PropertyCollector

use of org.jkiss.dbeaver.runtime.properties.PropertyCollector in project dbeaver by serge-rider.

the class ColumnInfoPanel method createPanel.

protected void createPanel(IAttributeController valueController) {
    PropertyCollector infoItem = new PropertyCollector(valueController.getBinding().getMetaAttribute(), false);
    infoItem.collectProperties();
    valueController.getValueManager().contributeProperties(infoItem, valueController);
    DBDRowIdentifier rowIdentifier = valueController.getRowIdentifier();
    if (rowIdentifier != null) {
        infoItem.addProperty(null, "Key", DataEditorsMessages.controls_column_info_panel_property_key, new CellKeyInfo(valueController.getRowController(), rowIdentifier));
    }
    this.setLayout(new FillLayout());
    {
        propViewer = new PropertyTreeViewer(this, SWT.H_SCROLL | SWT.V_SCROLL);
        propViewer.loadProperties(infoItem);
    }
}
Also used : PropertyTreeViewer(org.jkiss.dbeaver.ui.properties.PropertyTreeViewer) PropertyCollector(org.jkiss.dbeaver.runtime.properties.PropertyCollector) FillLayout(org.eclipse.swt.layout.FillLayout) DBDRowIdentifier(org.jkiss.dbeaver.model.data.DBDRowIdentifier)

Example 18 with PropertyCollector

use of org.jkiss.dbeaver.runtime.properties.PropertyCollector in project dbeaver by serge-rider.

the class SessionManagerViewer method showPlanNode.

private void showPlanNode() {
    detailsItem.setText("Plan Details");
    ISelection selection = planViewer.getSelection();
    if (selection.isEmpty()) {
        sessionProps.clearProperties();
    } else if (selection instanceof IStructuredSelection) {
        Object element = ((IStructuredSelection) selection).getFirstElement();
        if (element != selectedPlanElement) {
            PropertyCollector propertySource = new PropertyCollector(element, true);
            propertySource.collectProperties();
            sessionProps.loadProperties(propertySource);
            selectedPlanElement = element;
        }
    }
}
Also used : ISelection(org.eclipse.jface.viewers.ISelection) PropertyCollector(org.jkiss.dbeaver.runtime.properties.PropertyCollector) DBPObject(org.jkiss.dbeaver.model.DBPObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 19 with PropertyCollector

use of org.jkiss.dbeaver.runtime.properties.PropertyCollector in project dbeaver by dbeaver.

the class DBInfoUtils method makeObjectDescription.

public static String makeObjectDescription(@NotNull DBRProgressMonitor monitor, DBPNamedObject object, boolean html) {
    StringBuilder info = new StringBuilder();
    DBPNamedObject targetObject = object;
    if (object instanceof DBSObjectReference) {
        try {
            targetObject = ((DBSObjectReference) object).resolveObject(monitor);
        } catch (DBException e) {
            StringWriter buf = new StringWriter();
            e.printStackTrace(new PrintWriter(buf, true));
            info.append(buf.toString());
        }
    }
    PropertyCollector collector = new PropertyCollector(targetObject, false);
    collector.collectProperties();
    for (DBPPropertyDescriptor descriptor : collector.getProperties()) {
        Object propValue = collector.getPropertyValue(null, descriptor.getId());
        if (propValue == null) {
            continue;
        }
        String propString;
        if (propValue instanceof DBPNamedObject) {
            propString = ((DBPNamedObject) propValue).getName();
        } else {
            propString = DBValueFormatting.getDefaultValueDisplayString(propValue, DBDDisplayFormat.UI);
        }
        if (CommonUtils.isEmpty(propString)) {
            continue;
        }
        if (html) {
            info.append("<b>").append(descriptor.getDisplayName()).append(":  </b>");
            info.append(propString);
            info.append("<br>");
        } else {
            info.append(descriptor.getDisplayName()).append(": ").append(propString).append("\n");
        }
    }
    return info.toString();
}
Also used : DBException(org.jkiss.dbeaver.DBException) StringWriter(java.io.StringWriter) DBSObjectReference(org.jkiss.dbeaver.model.struct.DBSObjectReference) PropertyCollector(org.jkiss.dbeaver.runtime.properties.PropertyCollector) PrintWriter(java.io.PrintWriter) DBPPropertyDescriptor(org.jkiss.dbeaver.model.preferences.DBPPropertyDescriptor)

Example 20 with PropertyCollector

use of org.jkiss.dbeaver.runtime.properties.PropertyCollector in project dbeaver by dbeaver.

the class MySQLTable method getStatProperties.

@Nullable
@Override
public DBPPropertySource getStatProperties() {
    PropertyCollector collector = new PropertyCollector(additionalInfo, true);
    collector.collectProperties();
    return collector;
}
Also used : PropertyCollector(org.jkiss.dbeaver.runtime.properties.PropertyCollector) Nullable(org.jkiss.code.Nullable)

Aggregations

PropertyCollector (org.jkiss.dbeaver.runtime.properties.PropertyCollector)22 FillLayout (org.eclipse.swt.layout.FillLayout)4 DBPObject (org.jkiss.dbeaver.model.DBPObject)4 DBPPropertyDescriptor (org.jkiss.dbeaver.model.preferences.DBPPropertyDescriptor)4 PropertySourceDelegate (org.jkiss.dbeaver.ui.properties.PropertySourceDelegate)4 PropertyTreeViewer (org.jkiss.dbeaver.ui.properties.PropertyTreeViewer)4 DBDRowIdentifier (org.jkiss.dbeaver.model.data.DBDRowIdentifier)3 PrintWriter (java.io.PrintWriter)2 StringWriter (java.io.StringWriter)2 IAdaptable (org.eclipse.core.runtime.IAdaptable)2 IFindReplaceTarget (org.eclipse.jface.text.IFindReplaceTarget)2 ISelection (org.eclipse.jface.viewers.ISelection)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 CTabItem (org.eclipse.swt.custom.CTabItem)2 StyledText (org.eclipse.swt.custom.StyledText)2 IWorkbenchAdapter (org.eclipse.ui.model.IWorkbenchAdapter)2 WorkbenchAdapter (org.eclipse.ui.model.WorkbenchAdapter)2 IPropertySource (org.eclipse.ui.views.properties.IPropertySource)2 NotNull (org.jkiss.code.NotNull)2 Nullable (org.jkiss.code.Nullable)2