Search in sources :

Example 1 with DBECommandProperty

use of org.jkiss.dbeaver.model.edit.prop.DBECommandProperty in project dbeaver by dbeaver.

the class TabbedFolderPageForm method createControl.

@Override
public void createControl(Composite parent) {
    this.boldFont = UIUtils.makeBoldFont(parent.getFont());
    // ScrolledComposite scrolled = new ScrolledComposite(parent, SWT.V_SCROLL);
    // scrolled.setLayout(new GridLayout(1, false));
    propertiesGroup = new Composite(parent, SWT.NONE);
    // CSSUtils.setCSSClass(propertiesGroup, DBStyles.COLORED_BY_CONNECTION_TYPE);
    curPropertySource = input.getPropertySource();
    DBECommandContext commandContext = input.getCommandContext();
    if (commandContext != null) {
        commandContext.addCommandListener(new DBECommandAdapter() {

            @Override
            public void onCommandChange(DBECommand<?> command) {
                UIUtils.asyncExec(() -> {
                    updateEditButtonsState();
                    if (command instanceof DBECommandProperty) {
                        // We need to exclude current prop from update
                        // Simple value compare on update is not enough because value can be transformed (e.g. uppercased)
                        // and it will differ from the value in edit control
                        Object propId = ((DBECommandProperty<?>) command).getHandler().getId();
                        updateOtherPropertyValues(propId);
                    }
                });
            }

            @Override
            public void onSave() {
                UIUtils.asyncExec(() -> updateEditButtonsState());
            }

            @Override
            public void onReset() {
                UIUtils.asyncExec(() -> {
                    refreshProperties();
                    updateEditButtonsState();
                });
            }
        });
    }
    propertiesGroup.addDisposeListener(e -> dispose());
    refreshProperties();
}
Also used : DBECommandProperty(org.jkiss.dbeaver.model.edit.prop.DBECommandProperty) DBECommandContext(org.jkiss.dbeaver.model.edit.DBECommandContext) DBECommandAdapter(org.jkiss.dbeaver.model.impl.edit.DBECommandAdapter) DBSObject(org.jkiss.dbeaver.model.struct.DBSObject) DBPNamedObject(org.jkiss.dbeaver.model.DBPNamedObject)

Example 2 with DBECommandProperty

use of org.jkiss.dbeaver.model.edit.prop.DBECommandProperty in project dbeaver by serge-rider.

the class TabbedFolderPageForm method createControl.

@Override
public void createControl(Composite parent) {
    this.boldFont = UIUtils.makeBoldFont(parent.getFont());
    // ScrolledComposite scrolled = new ScrolledComposite(parent, SWT.V_SCROLL);
    // scrolled.setLayout(new GridLayout(1, false));
    propertiesGroup = new Composite(parent, SWT.NONE);
    // CSSUtils.setCSSClass(propertiesGroup, DBStyles.COLORED_BY_CONNECTION_TYPE);
    curPropertySource = input.getPropertySource();
    DBECommandContext commandContext = input.getCommandContext();
    if (commandContext != null) {
        commandContext.addCommandListener(new DBECommandAdapter() {

            @Override
            public void onCommandChange(DBECommand<?> command) {
                UIUtils.asyncExec(() -> {
                    updateEditButtonsState();
                    if (command instanceof DBECommandProperty) {
                        // We need to exclude current prop from update
                        // Simple value compare on update is not enough because value can be transformed (e.g. uppercased)
                        // and it will differ from the value in edit control
                        Object propId = ((DBECommandProperty<?>) command).getHandler().getId();
                        updateOtherPropertyValues(propId);
                    }
                });
            }

            @Override
            public void onSave() {
                UIUtils.asyncExec(() -> updateEditButtonsState());
            }

            @Override
            public void onReset() {
                UIUtils.asyncExec(() -> {
                    refreshProperties();
                    updateEditButtonsState();
                });
            }
        });
    }
    propertiesGroup.addDisposeListener(e -> dispose());
    refreshProperties();
}
Also used : DBECommandProperty(org.jkiss.dbeaver.model.edit.prop.DBECommandProperty) DBECommandContext(org.jkiss.dbeaver.model.edit.DBECommandContext) DBECommandAdapter(org.jkiss.dbeaver.model.impl.edit.DBECommandAdapter) DBSObject(org.jkiss.dbeaver.model.struct.DBSObject) DBPNamedObject(org.jkiss.dbeaver.model.DBPNamedObject)

Aggregations

DBPNamedObject (org.jkiss.dbeaver.model.DBPNamedObject)2 DBECommandContext (org.jkiss.dbeaver.model.edit.DBECommandContext)2 DBECommandProperty (org.jkiss.dbeaver.model.edit.prop.DBECommandProperty)2 DBECommandAdapter (org.jkiss.dbeaver.model.impl.edit.DBECommandAdapter)2 DBSObject (org.jkiss.dbeaver.model.struct.DBSObject)2