private void TabControl_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (tabControl.SelectedIndex < tabControl.TabPages.Count - 1)
     {
         if (ContainsDocument(tabControl.SelectedTab.Text))
         {
             SwitchDocument(tabControl.SelectedTab.Text);
         }
         else
         {
             CurrentCodeEditor.NewDocument(tabControl.SelectedTab.Text);
         }
     }
 }
        public void SaveAs()
        {
            saveFileDialog.FileName = CurrentFileName;

            if (saveFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            File.WriteAllText(saveFileDialog.FileName, Text);

            if (saveFileDialog.FileName != CurrentFileName)
            {
                CurrentCodeEditor.RenameDocument(tabControl.SelectedTab.Text, saveFileDialog.FileName);
                CurrentFileName = saveFileDialog.FileName;
            }
            tabControl.SelectedTab.ImageIndex = 0;
        }
        public void ChangeEditorType() //TODO: test
        {
            if (_codeEditorType == Settings.Default.CodeEditor)
            {
                return;
            }

            var currentDocument = CurrentFileName;

            var documents = new Dictionary <string, string>();

            foreach (var document in CurrentCodeEditor.Documents)
            {
                SwitchDocument(document);
                documents.Add(document, Text);
                CloseDocument(document);
            }

            SetEditorVisibility();

            foreach (var document in documents)
            {
                if (CurrentCodeEditor.ContainsDocument(document.Key))
                {
                    SwitchDocument(document.Key);
                }
                else
                {
                    CurrentCodeEditor.NewDocument(document.Key);
                }

                Text = document.Value;
                // MessageBox.Show(Text);
            }

            SwitchDocument(currentDocument);
        }
 public void CloseDocument(string filename)
 {
     CurrentCodeEditor.CloseDocument(filename);
 }
 public void SwitchDocument(string filename)
 {
     CurrentCodeEditor.SwitchDocument(filename);
 }
 public void AppendText(string text)
 {
     CurrentCodeEditor.AppendText(text);
 }
 public void SelectAll()
 {
     CurrentCodeEditor.SelectAll();
 }
 public void Copy()
 {
     CurrentCodeEditor.Copy();
 }
 public void Paste()
 {
     CurrentCodeEditor.Paste();
 }
 public void Cut()
 {
     CurrentCodeEditor.Cut();
 }
 public void Redo()
 {
     CurrentCodeEditor.Redo();
 }
 public void Undo()
 {
     CurrentCodeEditor.Undo();
 }
 public void HighlightErrors(IEnumerable <CompilerError> errors)
 {
     CurrentCodeEditor.HighlightErrors(errors);
 }
 public bool ContainsDocument(string filename)
 {
     return(CurrentCodeEditor.ContainsDocument(filename));
 }
 public void ClearHighlightedErrors()
 {
     CurrentCodeEditor.ClearHighlightedErrors();
 }