コード例 #1
0
 void SetupContextMenu(CSharpSymbolContextMenu menu, SymbolItem item)
 {
     if (item.SyntaxNode != null)
     {
         SetupMenuCommand(item, IconIds.SelectCode, R.CMD_SelectCode, s => {
             if (s.IsExternal)
             {
                 s.SyntaxNode.SelectNode(true);
             }
             else
             {
                 s.Container.SemanticContext.View.SelectNode(s.SyntaxNode, true);
             }
         });
         //SetupMenuCommand(item, KnownImageIds.Copy, "Copy Code", s => Clipboard.SetText(s.SyntaxNode.ToFullString()));
         item.SetSymbolToSyntaxNode();
     }
     if (item.Symbol != null)
     {
         if (item.SyntaxNode == null && item.Symbol.HasSource())
         {
             menu.AddSymbolNodeCommands();
         }
         else
         {
             menu.AddSymbolCommands();
         }
         menu.Items.Add(new Separator());
         menu.SyntaxNode = item.SyntaxNode;
         menu.Symbol     = item.Symbol;
         menu.AddAnalysisCommands();
     }
 }
コード例 #2
0
 void SetupContextMenu(CSharpSymbolContextMenu menu, SymbolItem item)
 {
     if (item.SyntaxNode != null)
     {
         SetupMenuCommand(item, KnownImageIds.BlockSelection, "Select Code", s => s.Container.SemanticContext.View.SelectNode(s.SyntaxNode, true));
         //SetupMenuCommand(item, KnownImageIds.Copy, "Copy Code", s => Clipboard.SetText(s.SyntaxNode.ToFullString()));
         item.SetSymbolToSyntaxNode();
     }
     if (item.Symbol != null)
     {
         if (item.SyntaxNode == null && item.Symbol.HasSource())
         {
             SetupMenuCommand(item, KnownImageIds.GoToDefinition, "Go to Definition", s => s.Symbol.GoToSource());
             SetupMenuCommand(item, KnownImageIds.BlockSelection, "Select Code", s => s.Symbol.GetSyntaxNode().SelectNode(true));
         }
         menu.AddSymbolCommands();
         menu.Items.Add(new Separator());
         menu.SyntaxNode = item.SyntaxNode;
         menu.Symbol     = item.Symbol;
         menu.AddAnalysisCommands();
     }
 }