public AspectWindowPane(IDEInterop ide) { try { this.ide = ide; KeyboardShortcutHelper.control = this; //Hardcoded language Thread.CurrentThread.CurrentUICulture = new CultureInfo("ru"); InitializeComponent(); Adapter = new AspectCore.TreeViewAdapter(Manager, tvAspects); fmSelectPoint = new FmSelectPoint(ide, treeManager); SynchronizeUndoButtons(); if (treeManager.GetParsersCount() == 0) { GlobalData.traceAction(Strings.NoParsers); } GlobalData.traceAction("Загрузка плагина завершена"); GlobalData.traceAction("Версия .net: " + System.Environment.Version); GlobalData.traceAction(System.Environment.Is64BitProcess ? "64-разрядный процесс" : "32-разрядный процесс"); //костыль tvAspects.Scrollable = true; } catch (Exception exc) { ExceptionInfoHelper.ShowInfo(exc); } }
public AspectWindowPane(IDEInterop ide) { try { this.ide = ide; KeyboardShortcutHelper.control = this; //Hardcoded language Thread.CurrentThread.CurrentUICulture = new CultureInfo("ru"); InitializeComponent(); Adapter = new AspectCore.TreeViewAdapter(Manager, tvAspects); fmSelectPoint = new FmSelectPoint(ide, treeManager); SynchronizeUndoButtons(); if (treeManager.GetParsersCount() == 0) GlobalData.traceAction(Strings.NoParsers); GlobalData.traceAction("Загрузка плагина завершена"); GlobalData.traceAction("Версия .net: " + System.Environment.Version); GlobalData.traceAction(System.Environment.Is64BitProcess ? "64-разрядный процесс" : "32-разрядный процесс"); //костыль tvAspects.Scrollable = true; } catch (Exception exc) { ExceptionInfoHelper.ShowInfo(exc); } }
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); }
/// <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; }
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); }