private void doTextWidgetChanged(Widget w) { if (w == _fNameText) { _fSuppressError = false; String name = _fNameText.getText(); _fTemplate.setName(name); updateButtons(); } else if (w == _fContextCombo) { String name = _fContextCombo.getText(); String contextId = getContextId(name); _fTemplate.setContextTypeId(contextId); _fTemplateProcessor.setContextType(_fContextTypeRegistry.getContextType(contextId)); } else if (w == _fDescriptionText) { String desc = _fDescriptionText.getText(); _fTemplate.setDescription(desc); } }
public void run() { Template template = new Template(); template.setPattern(_sqlEditor.getSelectedText()); SQLDevToolsConfiguration config = SQLToolsFacade.getConfigurationByVendorIdentifier(_sqlEditor.getConnectionInfo().getDatabaseVendorDefinitionId()); SQLService sqlService = config.getSQLService(); template.setContextTypeId(sqlService.getSQLContextType().getSQLContextId()); Dialog dialog = new EditTemplateDialog(null, template, false, true, SQLEditorPlugin.getDefault().getTemplateContextTypeRegistry()); if (dialog.open() == Window.OK) { TemplatePersistenceData data = new TemplatePersistenceData(template, true); SQLEditorPlugin.getDefault().getTemplateStore().add(data); try { SQLEditorPlugin.getDefault().getTemplateStore().save(); } catch (IOException e) { openWriteErrorDialog(e); } } }