public void SetUp() { _editor = new SqlTextEditor(); var connectionConfiguration = ConfigurationProvider.GetConnectionConfiguration(ConfigurationProvider.ConnectionStrings[0].Name); _infrastructureFactory = connectionConfiguration.InfrastructureFactory; }
public ContextActionTextEditorCommand(SqlTextEditor textEditor, ContextAction contextAction) : base(contextAction) { if (textEditor == null) { throw new ArgumentNullException(nameof(textEditor)); } _textEditor = textEditor; }
public static void UpdateDocument(SqlTextEditor editor, ActionExecutionContext executionContext) { var caretOffset = editor.CaretOffset; var selectionLength = editor.SelectionLength; editor.ReplaceTextSegments(executionContext.SegmentsToReplace); var caretOffsetChanged = executionContext.CaretOffset != caretOffset; if (executionContext.SelectionLength != selectionLength) { editor.SelectionStart = caretOffsetChanged ? executionContext.CaretOffset : editor.CaretOffset; editor.SelectionLength = executionContext.SelectionLength; } if (caretOffsetChanged) { editor.CaretOffset = executionContext.CaretOffset; editor.ScrollToCaret(); } }
public void SetUp() { _editor = new SqlTextEditor(); }
public static void ExecuteEditCommand(SqlDocumentRepository documentRepository, SqlTextEditor editor, Action <ActionExecutionContext> executionHandler) { if (editor.IsReadOnly || !String.Equals(documentRepository.StatementText, editor.Text)) { return; } var executionContext = ActionExecutionContext.Create(editor, documentRepository); try { executionHandler(executionContext); UpdateDocument(editor, executionContext); } catch (Exception exception) { App.LogErrorAndShowMessage(exception); } }