private void AddDDL()
        {
            ExplorerItem item = this._node.ExplorerItem;

            if (item.SupportsDDLEditing)
            {
                this._schemaName = "dbo";
                ExplorerItemNode parent = this._node.Parent.Parent as ExplorerItemNode;
                if ((parent != null) && (parent.ExplorerItem.Kind == ExplorerItemKind.Schema))
                {
                    this._schemaName = parent.ExplorerItem.SqlName ?? (parent.ExplorerItem.DragText ?? parent.ExplorerItem.Text);
                }
                this._constructName = (item.Icon == ExplorerIcon.StoredProc) ? "PROCEDURE" : ((item.Icon == ExplorerIcon.View) ? "View" : "FUNCTION");
                string str = (item.Icon == ExplorerIcon.StoredProc) ? "Stored Proc" : "Function";
                if (this.Items.Count > 0)
                {
                    this.Items.Add("-");
                }
                this.Items.Add("Edit " + str + " Definition", null, delegate(object sender, EventArgs e) {
                    NewQueryArgs args = new NewQueryArgs(new Func <string>(this.SpHelpText))
                    {
                        Language  = 8,
                        QueryName = "(" + item.SqlName + ")"
                    };
                    this._tree.OnNewQuery(args);
                });
                this.Items.Add("Drop " + str, null, delegate(object sender, EventArgs e) {
                    if (MessageBox.Show("Drop " + item.SqlName + " - are you sure?", "LINQPad", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                    {
                        this.DropObject();
                    }
                });
            }
        }
Пример #2
0
        internal bool ProcessClick()
        {
            // This item is obfuscated and can not be translated.
            if (this._explorerItem.HyperlinkTarget == null)
            {
                return(false);
            }
            for (TreeNode node = base.Parent; node == null; node = node.Parent)
            {
Label_0024:
                if (0 == 0)
                {
                    RepositoryNode node2 = node as RepositoryNode;
                    if (node2 == null)
                    {
                        return(false);
                    }
                    ExplorerItemNode node3 = node2.FindExplorerItemNode(this._explorerItem.HyperlinkTarget);
                    if (node3 == null)
                    {
                        return(false);
                    }
                    base.TreeView.SelectedNode = node3;
                    if (node3.Nodes.Count > 0)
                    {
                        node3.Nodes.Cast <TreeNode>().Take <TreeNode>(7).Last <TreeNode>().EnsureVisible();
                    }
                    return(true);
                }
            }
            goto Label_0024;
        }
Пример #3
0
 private ExplorerItemNode FindExplorerItemNode(TreeNode parent, ExplorerItem item)
 {
     foreach (ExplorerItemNode node in parent.Nodes.OfType <ExplorerItemNode>())
     {
         if (node.ExplorerItem == item)
         {
             return(node);
         }
     }
     foreach (TreeNode node3 in parent.Nodes)
     {
         ExplorerItemNode node4 = this.FindExplorerItemNode(node3, item);
         if (node4 != null)
         {
             return(node4);
         }
     }
     return(null);
 }
        public ExplorerItemContextMenu(SchemaTree tree, ExplorerItemNode node)
        {
            this._tree = tree;
            this._node = node;
            this._item = node.ExplorerItem;
            string dragText = node.ExplorerItem.DragText;

            if (string.IsNullOrEmpty(dragText))
            {
                dragText = node.Text;
            }
            if (this._item.Children != null)
            {
            }
            bool flag = (CS$ < > 9__CachedAnonymousMethodDelegate5 == null) && this._item.Children.Any <ExplorerItem>(CS$ < > 9__CachedAnonymousMethodDelegate5);

            if (((this._item.Icon == ExplorerIcon.StoredProc) || (this._item.Icon == ExplorerIcon.ScalarFunction)) || (this._item.Icon == ExplorerIcon.TableFunction))
            {
                string        paramQuery   = dragText = dragText + (!flag ? "()" : " (...)");
                QueryLanguage exprLanguage = UserOptions.Instance.IsVBDefault ? QueryLanguage.VBExpression : QueryLanguage.Expression;
                this.Items.Add(paramQuery, null, delegate(object sender, EventArgs e) {
                    NewQueryArgs args = new NewQueryArgs(paramQuery, new QueryLanguage?(exprLanguage))
                    {
                        ShowParams = true
                    };
                    tree.OnNewQuery(args);
                });
                if (this._item.Icon != ExplorerIcon.TableFunction)
                {
                    this.AddDDL();
                    return;
                }
            }
            IEnumerable <string> columnNames = from n in node.Nodes.OfType <ExplorerItemNode>()
                                               where (n.ExplorerItem.Kind == ExplorerItemKind.Property) && !string.IsNullOrEmpty(n.DragText)
                                               select n.DragText;

            QueryableMenuHelper.AddQueryableItems(tree, node, this, dragText, columnNames);
            this.AddDDL();
        }