示例#1
0
        /// <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);
        }
示例#2
0
        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;
        }
示例#4
0
        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);
        }
示例#5
0
 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;
             }
         }
     }
 }
示例#6
0
 public void SetSelectedComponent(BuildFileWrapper file)
 {
     this.SetBuildFile(file, _treeView.AllNodes);
 }
示例#7
0
 public void SetSelectedComponent(ComponentWrapper component, BuildFileWrapper file)
 {
     TreeNodeAdv node = this.FindNode(component);
     if (node != null)
     {
         this.SetBuildFile(file, AllChildren(node));
     }
 }
示例#8
0
 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(ComponentWrapper component, BuildFileWrapper file)
 {
     _treeView.SetSelectedComponent(component, file);
 }
示例#10
0
 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;
 }
示例#17
0
 public void SetSelectedComponent(BuildFileWrapper file)
 {
     this.SetBuildFile(file, _treeView.AllNodes);
 }
 public void SetSelectedComponent(BuildFileWrapper file)
 {
     _treeView.SetSelectedComponent(file);
 }
示例#19
0
 public MFSourceFileTreeNode(BuildFileWrapper BuildFile)
     : base(Path.GetFileName(BuildFile.File), FileName2ImageKey(BuildFile))
 {
     this.BuildFile = BuildFile;
     this.Tag       = BuildFile;
 }
示例#20
0
 public void SetSelectedComponent(BuildFileWrapper file)
 {
     _treeView.SetSelectedComponent(file);
 }