Search in sources :

Example 1 with PropertyPageStandard

use of org.jkiss.dbeaver.ui.controls.PropertyPageStandard in project dbeaver by dbeaver.

the class EntityEditor method getAdapter.

@Override
public <T> T getAdapter(Class<T> adapter) {
    T activeAdapter = getNestedAdapter(adapter);
    if (activeAdapter != null) {
        return activeAdapter;
    }
    if (adapter == IPropertySheetPage.class) {
        return adapter.cast(new PropertyPageStandard());
    }
    if (adapter == DBSObject.class) {
        IDatabaseEditorInput editorInput = getEditorInput();
        DBSObject databaseObject = editorInput.getDatabaseObject();
        return adapter.cast(databaseObject);
    }
    return super.getAdapter(adapter);
}
Also used : DBSObject(org.jkiss.dbeaver.model.struct.DBSObject) PropertyPageStandard(org.jkiss.dbeaver.ui.controls.PropertyPageStandard) SWT(org.eclipse.swt.SWT)

Example 2 with PropertyPageStandard

use of org.jkiss.dbeaver.ui.controls.PropertyPageStandard 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(new IPropertySourceProvider() {

            @Nullable
            @Override
            public IPropertySource getPropertySource(Object 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) IPropertySourceProvider(org.eclipse.ui.views.properties.IPropertySourceProvider) PropertySourceDelegate(org.jkiss.dbeaver.ui.properties.PropertySourceDelegate) PropertyCollector(org.jkiss.dbeaver.runtime.properties.PropertyCollector) IPropertySource(org.eclipse.ui.views.properties.IPropertySource) IFindReplaceTarget(org.eclipse.jface.text.IFindReplaceTarget) Nullable(org.jkiss.code.Nullable)

Example 3 with PropertyPageStandard

use of org.jkiss.dbeaver.ui.controls.PropertyPageStandard in project dbeaver by serge-rider.

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)

Example 4 with PropertyPageStandard

use of org.jkiss.dbeaver.ui.controls.PropertyPageStandard in project dbeaver by serge-rider.

the class EntityEditor method getAdapter.

@Override
public <T> T getAdapter(Class<T> adapter) {
    T activeAdapter = getNestedAdapter(adapter);
    if (activeAdapter != null) {
        return activeAdapter;
    }
    if (adapter == IPropertySheetPage.class) {
        return adapter.cast(new PropertyPageStandard());
    }
    if (adapter == DBSObject.class) {
        IDatabaseEditorInput editorInput = getEditorInput();
        DBSObject databaseObject = editorInput.getDatabaseObject();
        return adapter.cast(databaseObject);
    }
    return super.getAdapter(adapter);
}
Also used : DBSObject(org.jkiss.dbeaver.model.struct.DBSObject) PropertyPageStandard(org.jkiss.dbeaver.ui.controls.PropertyPageStandard) SWT(org.eclipse.swt.SWT)

Aggregations

PropertyPageStandard (org.jkiss.dbeaver.ui.controls.PropertyPageStandard)4 IFindReplaceTarget (org.eclipse.jface.text.IFindReplaceTarget)2 SWT (org.eclipse.swt.SWT)2 DBSObject (org.jkiss.dbeaver.model.struct.DBSObject)2 PropertyCollector (org.jkiss.dbeaver.runtime.properties.PropertyCollector)2 PropertySourceDelegate (org.jkiss.dbeaver.ui.properties.PropertySourceDelegate)2 IPropertySource (org.eclipse.ui.views.properties.IPropertySource)1 IPropertySourceProvider (org.eclipse.ui.views.properties.IPropertySourceProvider)1 Nullable (org.jkiss.code.Nullable)1