Ejemplo n.º 1
0
        public Form1()
        {
            try
            {
                InitializeComponent();
                SetDialogFilter();

                if (treeManager.GetParsersCount() == 0)
                    treeManager = new TreeManager();

                UpdateStatus("Загружено парсеров " + treeManager.GetParsersCount() + ": " +string.Join(", ", treeManager.GetParserIDs()));
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
Ejemplo n.º 2
0
        public static void AddPoint(IDEInterop ide, TreeManager treeManager, AspectManager Manager, TreeViewAdapter Adapter, TreeNode NewParent, Action Callback)
        {
            if (ide.GetCurrentDocumentFileName() == "")
                return;

            string Text = ide.GetCurrentLine().Trim();
            if (Text == "")
                return;

            List<PointOfInterest> points = FindPointUnderCursor(ide, treeManager);
            if (points != null)
                foreach (PointOfInterest pt in points)
                {
                    pt.FileName = Manager.GetRelativePath(pt.FileName);
                    pt.Text = Text;
                }
            ShowPointDialog(Adapter, points, NewParent, true, Callback);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Поиск точки в текущем документе в позиции курсора
        /// Документ должен быть открыт.
        /// </summary>
        /// <param name="dte"></param>
        /// <param name="Wrapper"></param>
        /// <param name="Manager"></param>
        /// <returns></returns>
        public static List<PointOfInterest> FindPointUnderCursor(IDEInterop ide, TreeManager treeManager)
        {
            string SourceText = ide.GetCurrentTextDocument();
            PointOfInterest root = treeManager.GetTree(ide.GetCurrentDocumentFileName(), SourceText);
            LexLocation loc = ide.GetCursorPosition();
            string Text = ide.GetLine(loc.StartLine);
            List<PointOfInterest> Points = TreeSearchEngine.FindPointByLocation(root, loc.StartLine, loc.StartColumn);
            if (Points == null || Points.Count == 0)
                return null;

            List<PointOfInterest> Result = new List<PointOfInterest>();
            foreach (PointOfInterest pt in Points)
            {
                PointOfInterest p2 = pt.ClonePointAssignItems();
                p2.ApplyInnerContext();
                p2.Items = new List<PointOfInterest>();
                Result.Add(p2);
                TreeSearchEngine.SetNearLG(root, pt, SourceText, out p2.NearL, out p2.NearG);
            }

            int len = loc.StartLine == loc.EndLine ? loc.EndColumn - loc.StartColumn : Text.Length - loc.StartColumn;
            Result[0].Title = GetCurrentWord(Text, loc.StartColumn, len);
            return Result;
        }
Ejemplo n.º 4
0
        public static void EditPointAnchor(IDEInterop ide, TreeManager treeManager, AspectManager Manager, TreeViewAdapter Adapter, TreeNode Node, Action Callback)
        {
            if (ide.GetCurrentDocumentFileName() == "")
                return;

            string Text = ide.GetCurrentLine().Trim();
            if (Text == "")
                return;

            List<PointOfInterest> points = FindPointUnderCursor(ide, treeManager);
            PointOfInterest OriginalPoint = Adapter.GetPointByNode(Node);
            if (points != null)
                foreach (PointOfInterest pt in points)
                {
                    pt.FileName = Manager.GetRelativePath(pt.FileName);
                    pt.Title = OriginalPoint.Title;
                    pt.Note = OriginalPoint.Note;
                    pt.Text = Text;
                }

            ShowPointDialog(Adapter, points, Node, false, Callback);
        }