private void Command_TidyCode(bool All) { EditorElement[] editors; if (All) { editors = GetAllEditorElements(); } else { editors = new EditorElement[] { GetCurrentEditorElement() }; } for (int i = 0; i < editors.Length; ++i) { EditorElement ee = editors[i]; if (ee != null) { ee.editor.Document.BeginUpdate(); string source = ee.editor.Text; ee.editor.Document.Replace(0, source.Length, SPSyntaxTidy.TidyUp(source)); ee.editor.Document.EndUpdate(); } } }
private EditorElement[] GetEditorElementsForFRAction(out int editorIndex) { int editorStartIndex = 0; EditorElement[] editors = null; if (FindDestinies.SelectedIndex == 0) { editors = new EditorElement[] { GetCurrentEditorElement() }; } else { editors = GetAllEditorElements(); if (DockingPane.SelectedContent != null) { object checkElement = DockingPane.SelectedContent.Content; if (checkElement != null) { if (checkElement is EditorElement) { for (int i = 0; i < editors.Length; ++i) { if (editors[i] == checkElement) { editorStartIndex = i; } } } } } } editorIndex = editorStartIndex; return editors; }
public void AddEditorElement(string filePath, string name, bool SelectMe) { LayoutDocument layoutDocument = new LayoutDocument(); layoutDocument.Title = name; layoutDocument.Closing += layoutDocument_Closing; layoutDocument.ToolTip = filePath; EditorElement editor = new EditorElement(filePath); editor.Parent = layoutDocument; layoutDocument.Content = editor; EditorsReferences.Add(editor); DockingPane.Children.Add(layoutDocument); if (SelectMe) { DockingPane.SelectedContentIndex = DockingPane.ChildrenCount - 1; } }