@Override protected void contributeEditorCommands(ToolBarManager toolBarManager) { super.contributeEditorCommands(toolBarManager); toolBarManager.add(new Separator()); toolBarManager.add( new ControlContribution("DDLFormat") { @Override protected Control createControl(Composite parent) { 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()) { ddlFormat = format; getEditorInput() .getDatabaseObject() .getDataSource() .getContainer() .getPreferenceStore() .setValue(OracleConstants.PREF_KEY_DDL_FORMAT, ddlFormat.name()); refreshPart(this, true); break; } } } }); return ddlFormatCombo; } }); }
@Override public void init(IEditorSite site, IEditorInput input) throws PartInitException { super.init(site, input); }