private void ShowModel(string inputModel, string module) { this.DisableAllControls(); try { EditorTabItem tabItem = AddDocument(module); tabItem.Text = inputModel; tabItem.TabText = tabItem.TabText.TrimEnd('*'); } catch (Exception ex) { } this.EnableAllControls(); }
public EditorTabItem AddDocument(string moduleName) { EditorTabItem tabItem = new EditorTabItem(moduleName); tabItem.Tag = ""; tabItem.Show(DockContainer, DockState.Document); tabItem.CodeEditor.LineViewerStyle = LineViewerStyle.None; tabItem.FormClosing += new FormClosingEventHandler(tabItem_FormClosing); tabItem.CodeEditor.TextChanged += new EventHandler(editorControl_TextChanged); tabItem.TabActivited += new EditorTabItem.TabActivitedHandler(tabItem_Activated); tabItem.IsDirtyChanged += new EventHandler(editorControl_TextChanged); tabItem.Activate(); CurrentActiveTab = tabItem; return(tabItem); }
private void tabItem_FormClosing(object sender, FormClosingEventArgs e) { EditorTabItem currentDoc = sender as EditorTabItem; if (currentDoc != null) { if (currentDoc.TabText.EndsWith("*")) { DialogResult rt = MessageBox.Show(string.Format(Resources.Document__0__unsaved__Do_you_want_to_save_it_before_close_, currentDoc.TabText.TrimEnd('*')), Ultility.APPLICATION_NAME, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (rt == DialogResult.Yes) { this.Save(); } else if (rt == DialogResult.Cancel) { e.Cancel = true; return; } } } if (DockContainer.Documents.Length > 1) { //this.MenuButton_NavigateBack.PerformClick(); } else if (DockContainer.Documents.Length == 1) { while (this.FunctionalToolBar.Items.Count > 6) { this.FunctionalToolBar.Items.RemoveAt(this.FunctionalToolBar.Items.Count - 1); } CurrentActiveTab = null; } CheckForItemState(); }
private void OpenException(ParsingException ex) { try { if (string.IsNullOrEmpty(ex.FileName)) { if (CurrentEditorTabItem != null) { this.CurrentEditorTabItem.HandleParsingException(ex); } } else { EditorTabItem item1 = OpenFile(ex.FileName, false); if (item1 != null) { item1.HandleParsingException(ex); } } } catch (Exception) { } }
public SecondaryViewContentCollection(EditorTabItem parent) { this.parent = parent; }
internal NewCodeEditorEventArgs(ref EditorTabItem tabItem) { _EditorTabItem = tabItem; }
public FilesCollection(EditorTabItem parent) { this.parent = parent; }
private void newToolStripMenuItem_Click(object sender, EventArgs e) { EditorTabItem tabItem = AddDocument(Language.Name); tabItem.TabText = tabItem.TabText.TrimEnd('*'); }
private void tabItem_Activated(EditorTabItem tab) { CurrentActiveTab = tab; }
public EditorTabItem OpenFile(string filename, bool ShowMessageBox) { int N = DockContainer.Documents.Length; for (int i = 0; i < N; i++) { EditorTabItem item = DockContainer.Documents[i] as EditorTabItem; if (item != null) { if (item.FileName == filename) { item.Activate(); CurrentActiveTab = item; SetAllFileNameLabel(filename); return(item); } } } if (File.Exists(filename)) { try { SyntaxMode ModuleSyntax = null; foreach (string extension in Language.Extensions) { if (filename.ToLower().EndsWith(extension)) { ModuleSyntax = Language; break; } } if (ModuleSyntax == null) { if (ShowMessageBox) { MessageBox.Show(Resources.Error_happened_in_opening_ + filename + ".\r\n" + Resources.File_format_is_not_supported_by_PAT_, Common.Ultility.Ultility.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); } return(null); } try { OpenFilter = ""; if (ModuleSyntax.Name == Language.Name) { OpenFilter = Language.Name + " (*" + Language.ExtensionString + ")|*" + Language.ExtensionString + "|" + OpenFilter; } else { OpenFilter += Language.Name + " (*" + Language.ExtensionString + ")|*" + Language.ExtensionString + "|"; } OpenFilter += "All File (*.*)|*.*"; } catch (Exception) { } EditorTabItem tabItem = this.AddDocument(ModuleSyntax.Name); tabItem.Open(filename); SetAllFileNameLabel(filename); if (tabItem.TabText.EndsWith("*")) { tabItem.TabText = tabItem.TabText.TrimEnd('*'); } this.StatusLabel_Status.Text = "Ready"; return(tabItem); } catch (Exception ex) { if (ShowMessageBox) { MessageBox.Show(Resources.Open_Error_ + ex.Message + "\r\n" + Resources.Please_make_sure_that_the_format_is_correct_, Ultility.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { if (ShowMessageBox) { MessageBox.Show(Resources.Open_Error__the_selected_file_is_not_found_, Ultility.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error); } } return(null); }