Search in sources :

Example 6 with PropertySourceDelegate

use of org.jkiss.dbeaver.ui.properties.PropertySourceDelegate in project dbeaver by dbeaver.

the class SpreadsheetPresentation method getAdapter.

@Override
public <T> T getAdapter(Class<T> adapter) {
    if (adapter == IPropertySheetPage.class) {
        // Show cell properties
        PropertyPageStandard page = new PropertyPageStandard();
        page.setPropertySourceProvider(object -> {
            if (object instanceof GridCell) {
                GridCell cell = (GridCell) object;
                boolean recordMode = controller.isRecordMode();
                final DBDAttributeBinding attr = (DBDAttributeBinding) (recordMode ? cell.row : cell.col);
                final ResultSetRow row = (ResultSetRow) (recordMode ? cell.col : cell.row);
                final SpreadsheetValueController valueController = new SpreadsheetValueController(controller, attr, row, IValueController.EditType.NONE, null);
                PropertyCollector props = new PropertyCollector(valueController.getBinding().getAttribute(), false);
                props.collectProperties();
                valueController.getValueManager().contributeProperties(props, valueController);
                return new PropertySourceDelegate(props);
            }
            return null;
        });
        return adapter.cast(page);
    } else if (adapter == IFindReplaceTarget.class) {
        return adapter.cast(findReplaceTarget);
    }
    return null;
}
Also used : PropertyPageStandard(org.jkiss.dbeaver.ui.controls.PropertyPageStandard) PropertySourceDelegate(org.jkiss.dbeaver.ui.properties.PropertySourceDelegate) PropertyCollector(org.jkiss.dbeaver.runtime.properties.PropertyCollector) IFindReplaceTarget(org.eclipse.jface.text.IFindReplaceTarget)

Aggregations

PropertySourceDelegate (org.jkiss.dbeaver.ui.properties.PropertySourceDelegate)6 PropertyCollector (org.jkiss.dbeaver.runtime.properties.PropertyCollector)4 Collection (java.util.Collection)2 Map (java.util.Map)2 IAdaptable (org.eclipse.core.runtime.IAdaptable)2 IFindReplaceTarget (org.eclipse.jface.text.IFindReplaceTarget)2 IWorkbenchAdapter (org.eclipse.ui.model.IWorkbenchAdapter)2 WorkbenchAdapter (org.eclipse.ui.model.WorkbenchAdapter)2 IPropertySource (org.eclipse.ui.views.properties.IPropertySource)2 DBNDataSource (org.jkiss.dbeaver.model.navigator.DBNDataSource)2 DBNDatabaseFolder (org.jkiss.dbeaver.model.navigator.DBNDatabaseFolder)2 DBNNode (org.jkiss.dbeaver.model.navigator.DBNNode)2 DBNResource (org.jkiss.dbeaver.model.navigator.DBNResource)2 DBPPropertySource (org.jkiss.dbeaver.model.preferences.DBPPropertySource)2 PropertySourceCollection (org.jkiss.dbeaver.runtime.properties.PropertySourceCollection)2 PropertySourceMap (org.jkiss.dbeaver.runtime.properties.PropertySourceMap)2 PropertyPageStandard (org.jkiss.dbeaver.ui.controls.PropertyPageStandard)2