Search in sources :

Example 21 with DBVEntityAttribute

use of org.jkiss.dbeaver.model.virtual.DBVEntityAttribute in project dbeaver by dbeaver.

the class TransformerSettingsDialog method detectTransformers.

private void detectTransformers() {
    final DBPDataSource dataSource = viewer.getDataSource();
    DBVEntityAttribute vAttr = vEntity.getVirtualAttribute(currentAttribute, false);
    DBVTransformSettings settings = vAttr == null ? null : DBVUtils.getTransformSettings(vAttr, false);
    if (dataSource != null && settings != null && !CommonUtils.isEmpty(settings.getCustomTransformer())) {
        transformer = dataSource.getContainer().getPlatform().getValueHandlerRegistry().getTransformer(settings.getCustomTransformer());
    } else {
        transformer = null;
    }
    transformerList = DBWorkbench.getPlatform().getValueHandlerRegistry().findTransformers(currentAttribute.getDataSource(), currentAttribute, null);
}
Also used : DBVEntityAttribute(org.jkiss.dbeaver.model.virtual.DBVEntityAttribute) DBVTransformSettings(org.jkiss.dbeaver.model.virtual.DBVTransformSettings) DBPDataSource(org.jkiss.dbeaver.model.DBPDataSource)

Example 22 with DBVEntityAttribute

use of org.jkiss.dbeaver.model.virtual.DBVEntityAttribute in project dbeaver by dbeaver.

the class VirtualAttributeEditAction method run.

@Override
public void run() {
    if (attr == null) {
        return;
    }
    DBVEntityAttribute vAttr = ((DBDAttributeBindingCustom) attr).getEntityAttribute();
    DBVEntity vEntity = resultSetViewer.getModel().getVirtualEntity(false);
    if (new EditVirtualAttributePage(resultSetViewer, vAttr).edit(resultSetViewer.getControl().getShell())) {
        vEntity.persistConfiguration();
        resultSetViewer.refreshMetaData();
    }
}
Also used : DBVEntityAttribute(org.jkiss.dbeaver.model.virtual.DBVEntityAttribute) DBDAttributeBindingCustom(org.jkiss.dbeaver.model.data.DBDAttributeBindingCustom) DBVEntity(org.jkiss.dbeaver.model.virtual.DBVEntity)

Aggregations

DBVEntityAttribute (org.jkiss.dbeaver.model.virtual.DBVEntityAttribute)22 DBVEntity (org.jkiss.dbeaver.model.virtual.DBVEntity)10 DBDAttributeBinding (org.jkiss.dbeaver.model.data.DBDAttributeBinding)6 DBVTransformSettings (org.jkiss.dbeaver.model.virtual.DBVTransformSettings)6 GridData (org.eclipse.swt.layout.GridData)4 Composite (org.eclipse.swt.widgets.Composite)4 DBDAttributeBindingCustom (org.jkiss.dbeaver.model.data.DBDAttributeBindingCustom)4 ArrayList (java.util.ArrayList)2 Comparator (java.util.Comparator)2 List (java.util.List)2 JexlExpression (org.apache.commons.jexl3.JexlExpression)2 ComboContentAdapter (org.eclipse.jface.fieldassist.ComboContentAdapter)2 SWT (org.eclipse.swt.SWT)2 MouseAdapter (org.eclipse.swt.events.MouseAdapter)2 MouseEvent (org.eclipse.swt.events.MouseEvent)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 Button (org.eclipse.swt.widgets.Button)2 Combo (org.eclipse.swt.widgets.Combo)2 Control (org.eclipse.swt.widgets.Control)2