Search in sources :

Example 1 with PropertyCollector

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

the class ObjectPropertiesEditor method createPropertyRefreshAction.

private void createPropertyRefreshAction(IContributionManager contributionManager) {
    // Contribute "Read expensive props" - but only if object has expensive props
    DBSObject databaseObject = getDatabaseObject();
    if (!databaseObject.getDataSource().getContainer().getPreferenceStore().getBoolean(ModelPreferences.READ_EXPENSIVE_PROPERTIES)) {
        PropertyCollector collector = new PropertyCollector(databaseObject, false);
        collector.setEnableFilters(false);
        collector.collectProperties();
        boolean hasExpensive = false;
        for (DBPPropertyDescriptor prop : collector.getProperties()) {
            if (prop instanceof ObjectPropertyDescriptor && ((ObjectPropertyDescriptor) prop).isExpensive()) {
                hasExpensive = true;
                break;
            }
        }
        if (hasExpensive) {
            contributionManager.add(new ReadExpensivePropsAction(databaseObject));
        }
    }
}
Also used : DBSObject(org.jkiss.dbeaver.model.struct.DBSObject) PropertyCollector(org.jkiss.dbeaver.runtime.properties.PropertyCollector) ObjectPropertyDescriptor(org.jkiss.dbeaver.runtime.properties.ObjectPropertyDescriptor) DBPPropertyDescriptor(org.jkiss.dbeaver.model.preferences.DBPPropertyDescriptor)

Example 2 with PropertyCollector

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

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)

Example 3 with PropertyCollector

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

the class SessionManagerViewer method updatePreview.

private void updatePreview() {
    if (previewFolder.getSelectionIndex() == 0) {
        // Show SQL
        detailsItem.setText(SessionEditorMessages.viewer_details_item_session_details);
        updateSQL();
        if (curSession == null) {
            sessionProps.clearProperties();
        } else {
            PropertyCollector propCollector = new PropertyCollector(curSession, true);
            propCollector.collectProperties();
            sessionProps.loadProperties(propCollector);
        }
    } else if (planViewer != null) {
        // Show execution plan
        String sqlText = curSession == null ? "" : CommonUtils.notEmpty(curSession.getActiveQuery());
        if (!CommonUtils.isEmpty(sqlText)) {
            planViewer.explainQueryPlan(new SQLQuery(sessionManager.getDataSource(), sqlText), curSession.getActiveQueryId());
        }
    }
    if (detailsFolder.getSelectionIndex() > 0) {
        CTabItem detailsItem = detailsFolder.getItem(detailsFolder.getSelectionIndex());
        Object data = detailsItem.getData();
        if (data instanceof DBAServerSessionDetails) {
            if (detailsItem.getControl() instanceof StyledText) {
                StyledText styledText = (StyledText) detailsItem.getControl();
                loadPlainTextDetails((DBAServerSessionDetails) data, styledText);
            } else {
                DetailsListControl detailsListControl = (DetailsListControl) detailsItem.getControl();
                detailsListControl.loadData();
            }
        }
    }
}
Also used : StyledText(org.eclipse.swt.custom.StyledText) DBAServerSessionDetails(org.jkiss.dbeaver.model.admin.sessions.DBAServerSessionDetails) PropertyCollector(org.jkiss.dbeaver.runtime.properties.PropertyCollector) DBPObject(org.jkiss.dbeaver.model.DBPObject) SQLQuery(org.jkiss.dbeaver.model.sql.SQLQuery) CTabItem(org.eclipse.swt.custom.CTabItem)

Example 4 with PropertyCollector

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

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 5 with PropertyCollector

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

the class ObjectPropertiesEditor method createPropertyRefreshAction.

private void createPropertyRefreshAction(IContributionManager contributionManager) {
    // Contribute "Read expensive props" - but only if object has expensive props
    DBSObject databaseObject = getDatabaseObject();
    if (!databaseObject.getDataSource().getContainer().getPreferenceStore().getBoolean(ModelPreferences.READ_EXPENSIVE_PROPERTIES)) {
        PropertyCollector collector = new PropertyCollector(databaseObject, false);
        collector.setEnableFilters(false);
        collector.collectProperties();
        boolean hasExpensive = false;
        for (DBPPropertyDescriptor prop : collector.getProperties()) {
            if (prop instanceof ObjectPropertyDescriptor && ((ObjectPropertyDescriptor) prop).isExpensive()) {
                hasExpensive = true;
                break;
            }
        }
        if (hasExpensive) {
            contributionManager.add(new ReadExpensivePropsAction(databaseObject));
        }
    }
}
Also used : DBSObject(org.jkiss.dbeaver.model.struct.DBSObject) PropertyCollector(org.jkiss.dbeaver.runtime.properties.PropertyCollector) ObjectPropertyDescriptor(org.jkiss.dbeaver.runtime.properties.ObjectPropertyDescriptor) DBPPropertyDescriptor(org.jkiss.dbeaver.model.preferences.DBPPropertyDescriptor)

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