public void AddSourceEditor(RemoteSource SourceInfo, Language Language = Language.None) { string pageName = ""; switch (SourceInfo.GetFS()) { case FileSystem.QSYS: pageName = SourceInfo.GetLibrary() + "/" + SourceInfo.GetObject() + "(" + SourceInfo.GetName() + ")"; break; case FileSystem.IFS: pageName = SourceInfo.GetName() + "." + SourceInfo.GetExtension(); break; } OpenTab currentTab = EditorContains(pageName); if (File.Exists(SourceInfo.GetLocalFile())) { //Close tab if it already exists. if (currentTab != null) { switch (currentTab.getSide()) { case OpenTab.TAB_SIDE.Left: editortabsleft.TabPages.RemoveAt(currentTab.getIndex()); break; case OpenTab.TAB_SIDE.Right: editortabsright.TabPages.RemoveAt(currentTab.getIndex()); break; } } TabPage tabPage = new TabPage(pageName); tabPage.ImageIndex = 0; tabPage.ToolTipText = pageName; SourceEditor srcEdit = new SourceEditor(SourceInfo.GetLocalFile(), Language, SourceInfo.GetRecordLength()); srcEdit.SetReadOnly(!SourceInfo.IsEditable()); srcEdit.BringToFront(); srcEdit.Dock = DockStyle.Fill; srcEdit.Tag = SourceInfo; tabPage.Tag = SourceInfo; tabPage.Controls.Add(srcEdit); editortabsleft.TabPages.Add(tabPage); SwitchToTab(OpenTab.TAB_SIDE.Left, editortabsleft.TabPages.Count - 1); } else { MessageBox.Show("There was an error opening the local member. '" + SourceInfo.GetLocalFile() + "' does not exist"); } }
private void AddMemberEditor(Member MemberInfo, ILELanguage Language = ILELanguage.None) { string pageName = MemberInfo.GetLibrary() + "/" + MemberInfo.GetObject() + "(" + MemberInfo.GetMember() + ")"; OpenTab currentTab = EditorContains(pageName); if (File.Exists(MemberInfo.GetLocalFile())) { //Close tab if it already exists. if (currentTab != null) { switch (currentTab.getSide()) { case OpenTab.TAB_SIDE.Left: editortabsleft.TabPages.RemoveAt(currentTab.getIndex()); break; case OpenTab.TAB_SIDE.Right: editortabsright.TabPages.RemoveAt(currentTab.getIndex()); break; } } TabPage tabPage = new TabPage(pageName); tabPage.ImageIndex = 0; tabPage.ToolTipText = MemberInfo.GetLibrary() + "/" + MemberInfo.GetObject() + "(" + MemberInfo.GetMember() + ")"; SourceEditor srcEdit = new SourceEditor(MemberInfo.GetLocalFile(), Language, MemberInfo.GetRecordLength()); srcEdit.SetReadOnly(!MemberInfo.IsEditable()); srcEdit.BringToFront(); srcEdit.Dock = DockStyle.Fill; srcEdit.Tag = MemberInfo; tabPage.Tag = MemberInfo; tabPage.Controls.Add(srcEdit); editortabsleft.TabPages.Add(tabPage); SwitchToTab(OpenTab.TAB_SIDE.Left, editortabsleft.TabPages.Count - 1); } else { MessageBox.Show("There was an error opening the local member. '" + MemberInfo.GetLocalFile() + "' does not exist"); } }
private void AddFileEditor(string FilePath, Language Language) { string pageName = Path.GetFileName(FilePath); OpenTab currentTab = EditorContains(pageName); if (File.Exists(FilePath)) { if (currentTab != null) { switch (currentTab.getSide()) { case OpenTab.TAB_SIDE.Left: editortabsleft.TabPages.RemoveAt(currentTab.getIndex()); break; case OpenTab.TAB_SIDE.Right: editortabsright.TabPages.RemoveAt(currentTab.getIndex()); break; } } TabPage tabPage = new TabPage(pageName); tabPage.ImageIndex = 0; tabPage.ToolTipText = pageName; SourceEditor srcEdit = new SourceEditor(FilePath, Language); srcEdit.BringToFront(); srcEdit.Dock = DockStyle.Fill; srcEdit.Tag = null; tabPage.Tag = null; tabPage.Controls.Add(srcEdit); editortabsleft.TabPages.Add(tabPage); SwitchToTab(OpenTab.TAB_SIDE.Left, editortabsleft.TabPages.Count - 1); } }