/// <summary> /// Ru: Открывает редактор для объекта. Если такой уже открыт, то показывает его /// En: If object editor has been shown, opens it. I it has not been shown , creates it /// </summary> /// <param name="obj"></param> public void ShowEditor(object obj) { IEventComponent component = null; if (obj is LibraryWrapper) { LibraryWrapper library = (LibraryWrapper)obj; component = ShowLibraryEditorByGuid(library.Guid); } else if (obj is FeatureWrapper) { FeatureWrapper feature = (FeatureWrapper)obj; component = ShowFeatureEditorByGuid(feature.Guid); } else if (obj is LibraryCategoryWrapper) { LibraryCategoryWrapper libcat = (LibraryCategoryWrapper)obj; component = ShowLibraryCategoryEditorByGuid(libcat.Guid); } else if (obj is ComponentWrapper) { ComponentWrapper comp = (ComponentWrapper)obj; switch (comp.ComponentType) { case ComponentTypeWrapper.Library: component = ShowLibraryEditorByGuid(comp.Guid); break; case ComponentTypeWrapper.Feature: component = ShowFeatureEditorByGuid(comp.Guid); break; case ComponentTypeWrapper.LibraryCategory: component = ShowLibraryCategoryEditorByGuid(comp.Guid); break; default: break; } } else if (obj is BuildFileWrapper)//En: Need to open file editor Ru: Нужно отрыть редактор файлов { BuildFileWrapper file = (BuildFileWrapper)obj; if (!string.IsNullOrEmpty(file.FullPath) && (File.Exists(file.FullPath))) { OpenTextEditor(file.FullPath); } } else if (obj is EditFileDescriptor) { EditFileDescriptor file = (EditFileDescriptor)obj; SourceFileEditor editor = OpenTextEditor(file.Path); if (editor != null) { editor.GotoLine(file.Line - 1); } } OnShowEditor(component); }
public void SetSelectedComponent(ComponentWrapper component, BuildFileWrapper file) { TreeNodeAdv node = this.FindNode(component); if (node != null) { this.SetBuildFile(file, AllChildren(node)); } }
public static ImageKeysEnum FileName2ImageKey(BuildFileWrapper BuildFile) { ImageKeysEnum key = FileName2ImageKey(BuildFile.File); if (!File.Exists(BuildFile.FullPath)) { Debug.WriteLine(string.Format ("MFSourceFileTreeNode: \"File {0} not exists\"", BuildFile.FullPath)); key = ImageKeysEnum.Missing; } return key; }
public static ImageKeysEnum FileName2ImageKey(BuildFileWrapper BuildFile) { ImageKeysEnum key = FileName2ImageKey(BuildFile.File); if (!File.Exists(BuildFile.FullPath)) { Debug.WriteLine(string.Format("MFSourceFileTreeNode: \"File {0} not exists\"", BuildFile.FullPath)); key = ImageKeysEnum.Missing; } return(key); }
private void SetBuildFile(BuildFileWrapper file, IEnumerable nodes) { foreach (TreeNodeAdv child in nodes) { BuildFileNode invNode = child.Tag as BuildFileNode; if (invNode != null) { if (string.Compare(file.FullPath, invNode.TypedContent.FullPath, true) == 0) { _treeView.SelectedNode = child; break; } } } }
public void SetSelectedComponent(BuildFileWrapper file) { this.SetBuildFile(file, _treeView.AllNodes); }
public void SetSelectedComponent(ComponentWrapper component, BuildFileWrapper file) { _treeView.SetSelectedComponent(component, file); }
private void CheckTextInFile(SearchResultsHolder.SearchComponentDescriptor ProjectDesc, BuildFileWrapper file, string what, bool MatchCase, bool MatchWholeWord) { if (!File.Exists(file.FullPath)) return; m_SearchResults.TotalComponentsSearched++; using (StreamReader tr = new StreamReader(file.FullPath)) { int LineNum = 0; while (!tr.EndOfStream) { LineNum++; string Line = tr.ReadLine(); SearchResultsHolder.SearchComponentDescriptor CompDesc = new SearchResultsHolder.SearchComponentDescriptor(file); if (ProjectDesc != null) CompDesc.Parent = ProjectDesc; CompDesc.Line = new SearchResultsHolder.SearchComponentDescriptor.LineDescriptor(LineNum, Line); //if (MatchWholeWord) //{ // if (MatchCase) // { // if (file.Name == what) // { // m_SearchResults.FindedComponents.Add(CompDesc); // OnElementFinded(CompDesc); // } // } // else // { // if (file.Name.ToLower() == what.ToLower()) // { // m_SearchResults.FindedComponents.Add(CompDesc); // OnElementFinded(CompDesc); // } // } //} //else //{ if (MatchCase) { if (Line.Contains(what)) { m_SearchResults.FindedComponents.Add(CompDesc); OnElementFinded(CompDesc); } } else { if (Line.ToLower().Contains(what.ToLower())) { m_SearchResults.FindedComponents.Add(CompDesc); OnElementFinded(CompDesc); } } //} } } }
private void CheckTextInFile(BuildFileWrapper file, string what, bool MatchCase, bool MatchWholeWord) { CheckTextInFile(null, file, what, MatchCase, MatchWholeWord); }
private void CheckFile(SearchResultsHolder.SearchComponentDescriptor ProjectDesc, BuildFileWrapper file, string what, bool MatchCase, bool MatchWholeWord) { SearchResultsHolder.SearchComponentDescriptor CompDesc = new SearchResultsHolder.SearchComponentDescriptor(file); if (ProjectDesc != null) CompDesc.Parent = ProjectDesc; m_SearchResults.TotalComponentsSearched++; if (MatchWholeWord) { if (MatchCase) { if (file.Name == what) { if (!m_SearchResults.FindedComponents.Contains(CompDesc)) { m_SearchResults.FindedComponents.Add(CompDesc); OnElementFinded(CompDesc); } } } else { if (file.Name.ToLower() == what.ToLower()) { if (!m_SearchResults.FindedComponents.Contains(CompDesc)) { m_SearchResults.FindedComponents.Add(CompDesc); OnElementFinded(CompDesc); } } } } else { if (MatchCase) { if (file.Name.Contains(what)) { if (!m_SearchResults.FindedComponents.Contains(CompDesc)) { m_SearchResults.FindedComponents.Add(CompDesc); OnElementFinded(CompDesc); } } } else { if (file.Name.ToLower().Contains(what.ToLower())) { if (!m_SearchResults.FindedComponents.Contains(CompDesc)) { m_SearchResults.FindedComponents.Add(CompDesc); OnElementFinded(CompDesc); } } } } }
public SearchComponentDescriptor(SearchComponentDescriptor Parent, BuildFileWrapper File, LineDescriptor Line) { this.Parent = Parent; this.Component = null; this.File = File; this.Line = Line; }
public SearchComponentDescriptor(BuildFileWrapper File) { this.Parent = null; this.Component = null; this.File = File; this.Line = null; }
public MFSourceFileTreeNode(BuildFileWrapper BuildFile) : base(Path.GetFileName(BuildFile.File), FileName2ImageKey(BuildFile)) { this.BuildFile = BuildFile; this.Tag = BuildFile; }
public void SetSelectedComponent(BuildFileWrapper file) { _treeView.SetSelectedComponent(file); }