Search in sources :

Example 1 with OracleDDLFormat

use of org.jkiss.dbeaver.ext.oracle.model.OracleDDLFormat in project dbeaver by serge-rider.

the class OracleObjectDDLEditor method contributeEditorCommands.

@Override
protected void contributeEditorCommands(IContributionManager contributionManager) {
    super.contributeEditorCommands(contributionManager);
    contributionManager.add(new Separator());
    contributionManager.add(new ControlContribution("DDLFormat") {

        @Override
        protected Control createControl(Composite parent) {
            OracleDDLFormat ddlFormat = OracleDDLFormat.getCurrentFormat(getSourceObject().getDataSource());
            final Combo ddlFormatCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY | SWT.DROP_DOWN);
            ddlFormatCombo.setToolTipText("DDL Format");
            for (OracleDDLFormat format : OracleDDLFormat.values()) {
                ddlFormatCombo.add(format.getTitle());
                if (format == ddlFormat) {
                    ddlFormatCombo.select(ddlFormatCombo.getItemCount() - 1);
                }
            }
            ddlFormatCombo.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    for (OracleDDLFormat format : OracleDDLFormat.values()) {
                        if (format.ordinal() == ddlFormatCombo.getSelectionIndex()) {
                            getEditorInput().getDatabaseObject().getDataSource().getContainer().getPreferenceStore().setValue(OracleConstants.PREF_KEY_DDL_FORMAT, format.name());
                            refreshPart(this, true);
                            break;
                        }
                    }
                }
            });
            return ddlFormatCombo;
        }
    });
}
Also used : Control(org.eclipse.swt.widgets.Control) Composite(org.eclipse.swt.widgets.Composite) OracleDDLFormat(org.jkiss.dbeaver.ext.oracle.model.OracleDDLFormat) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ControlContribution(org.eclipse.jface.action.ControlContribution) Combo(org.eclipse.swt.widgets.Combo) Separator(org.eclipse.jface.action.Separator)

Aggregations

ControlContribution (org.eclipse.jface.action.ControlContribution)1 Separator (org.eclipse.jface.action.Separator)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Combo (org.eclipse.swt.widgets.Combo)1 Composite (org.eclipse.swt.widgets.Composite)1 Control (org.eclipse.swt.widgets.Control)1 OracleDDLFormat (org.jkiss.dbeaver.ext.oracle.model.OracleDDLFormat)1