use of org.jkiss.dbeaver.ext.db2.editors.DB2DDLFormat in project dbeaver by dbeaver.
the class DB2RoutineDDLEditor 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) {
DB2DDLFormat ddlFormat = DB2DDLFormat.getCurrentFormat(getSourceObject().getDataSource());
final Combo ddlFormatCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY | SWT.DROP_DOWN);
ddlFormatCombo.setToolTipText("DDL Format");
for (DB2DDLFormat format : DB2DDLFormat.values()) {
ddlFormatCombo.add(format.getTitle());
if (format == ddlFormat) {
ddlFormatCombo.select(ddlFormatCombo.getItemCount() - 1);
}
}
ddlFormatCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
for (DB2DDLFormat format : DB2DDLFormat.values()) {
if (format.ordinal() == ddlFormatCombo.getSelectionIndex()) {
getSourceObject().getDataSource().getContainer().getPreferenceStore().setValue(DB2Constants.PREF_KEY_DDL_FORMAT, format.name());
refreshPart(this, true);
break;
}
}
}
});
return ddlFormatCombo;
}
});
}
use of org.jkiss.dbeaver.ext.db2.editors.DB2DDLFormat in project dbeaver by serge-rider.
the class DB2RoutineDDLEditor 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) {
DB2DDLFormat ddlFormat = DB2DDLFormat.getCurrentFormat(getSourceObject().getDataSource());
final Combo ddlFormatCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY | SWT.DROP_DOWN);
ddlFormatCombo.setToolTipText("DDL Format");
for (DB2DDLFormat format : DB2DDLFormat.values()) {
ddlFormatCombo.add(format.getTitle());
if (format == ddlFormat) {
ddlFormatCombo.select(ddlFormatCombo.getItemCount() - 1);
}
}
ddlFormatCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
for (DB2DDLFormat format : DB2DDLFormat.values()) {
if (format.ordinal() == ddlFormatCombo.getSelectionIndex()) {
getSourceObject().getDataSource().getContainer().getPreferenceStore().setValue(DB2Constants.PREF_KEY_DDL_FORMAT, format.name());
refreshPart(this, true);
break;
}
}
}
});
return ddlFormatCombo;
}
});
}
Aggregations