private void onGoToDef(object sender, RoutedEventArgs e) { MenuItem item = sender as MenuItem; ContextMenu menu = item.CommandParameter as ContextMenu; FunctionInfo fi = (menu.PlacementTarget as StackPanel).Tag as FunctionInfo; if (fi != null) { IDEView.inst().ideTabs.OpenFile(new FileLeafItem { Path = fi.SourceFile, Name = System.IO.Path.GetFileName(fi.SourceFile) }, fi.SourceLine); } PropInfo pi = (menu.PlacementTarget as StackPanel).Tag as PropInfo; if (pi != null) { IDEView.inst().ideTabs.OpenFile(new FileLeafItem { Path = pi.SourceFile, Name = System.IO.Path.GetFileName(pi.SourceFile) }, pi.SourceLine); } TypeInfo ti = (menu.PlacementTarget as StackPanel).Tag as TypeInfo; if (ti != null) { IDEView.inst().ideTabs.OpenFile(new FileLeafItem { Path = ti.SourceFile, Name = System.IO.Path.GetFileName(ti.SourceFile) }, ti.SourceLine); } }
public static void doSearch(string text, string path) { IDEView.inst().SearchResults.Clear(); if (text.Trim().Length == 0) { return; } if (text.Contains(' ')) { text = "\"" + text + "\""; } Thread thread = new Thread(delegate() { FileSearch search = new FileSearch(IDEView.inst().Dispatcher, IDEView.inst().SearchResults); search.ScanFolder(path, new string[] { text }, true); }); thread.Start(); }
public override void HookEditor(ICSharpCode.AvalonEdit.TextEditor editor, FileBaseItem item) { editor.SyntaxHighlighting = AvalonExtensions.LoadHighlightingDefinition("Debugger.Resources.Angelscript.xshd"); editor.ContextMenu.Items.Add(new MenuItem { Header = "Compile", Command = new RelayCommand(p => { IDEView.Compile(); }) }); editor.ContextMenu.Items.Add(new Separator()); editor.ContextMenu.Items.Add(new MenuItem { Header = "New ScriptObject", Command = new RelayCommand(p => { editor.Document.BeginUpdate(); editor.Document.Insert(editor.CaretOffset, SOScript); editor.Document.EndUpdate(); }) }); editor.ContextMenu.Items.Add(new MenuItem { Header = "Insert #include", Command = new RelayCommand(p => { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.DefaultExt = "*"; dlg.Filter = "All files (*.*)|*.*"; if (dlg.ShowDialog() == true) { editor.Document.BeginUpdate(); foreach (string incDir in IDEProject.inst().Settings.GetIncludeDirectories()) { if (AngelscriptSource.isSubDir(incDir, dlg.FileName)) { // Everything came from System.IO.Path, should be normal form string strippedString = dlg.FileName.Replace(incDir + "\\", ""); //AngelscriptSource.MakeRelativePath(incDir, dlg.FileName); editor.Document.Insert(editor.CaretOffset, string.Format("#include \"{0}\"", strippedString).Replace("\\", "/")); editor.Document.EndUpdate(); return; } } editor.Document.Insert(editor.CaretOffset, string.Format("#include \"{0}\"", dlg.FileName)); editor.Document.EndUpdate(); } }) }); editor.ContextMenu.Items.Add(new MenuItem { Header = "Doxygen Comment", Command = new RelayCommand(p => { editor.Document.BeginUpdate(); editor.Document.Insert(editor.CaretOffset, @"///////////////////////////////////////////////// /// DOCUMENT_HERE /////////////////////////////////////////////////", AnchorMovementType.AfterInsertion); editor.Document.EndUpdate(); }) }); editor.ContextMenu.Items.Add(new MenuItem { Header = "Property Comment", Command = new RelayCommand(p => { editor.Document.BeginUpdate(); editor.Document.Insert(editor.CaretOffset, "///< DOCUMENT", AnchorMovementType.AfterInsertion); editor.Document.EndUpdate(); }) }); }