// ReSharper disable once UnusedMember.Local
        // ReSharper disable once UnusedParameter.Local
        private void Provider_SelectionChanged(object sender, NodesChangedEventArgs args)
        {
            if (args.ChangedNodes.Count <= 0)
            {
                return;
            }
            var node = args.ChangedNodes[0];

            if (node == null)
            {
                return;
            }
            Debug.WriteLine(node.UrnPath);
            Debug.WriteLine(node.Name);
            Debug.WriteLine(node.Context);
            if (_serverMenu == null && _urnPath == node.UrnPath)
            {
                _serverMenu = (HierarchyObject)node.GetService(typeof(IMenuHandler));
                //var separator = new ToolStripSeparatorMenuItem();
                //_serverMenu.AddChild(string.Empty, separator);
                var item = new DatabaseMenuItem(_package);
                _serverMenu.AddChild(string.Empty, item);
            }

            if (_tableMenu == null && _tableUrnPath == node.UrnPath)
            {
                _tableMenu = (HierarchyObject)node.GetService(typeof(IMenuHandler));
                //var separator = new ToolStripSeparatorMenuItem();
                //_serverMenu.AddChild(string.Empty, separator);
                var item = new TableMenuItem(_package);
                _tableMenu.AddChild(string.Empty, item);
            }
        }
Example #2
0
        private void Provider_SelectionChanged(object sender, NodesChangedEventArgs args)
        {
            INavigationContextProvider provider = (INavigationContextProvider)sender;
            INodeInformation           node     = (args.ChangedNodes.Count > 0 ? args.ChangedNodes[0] : null);

            if (_tableMenu == null &&
                _tableRegex.IsMatch(node.Context))
            {
                _tableMenu = (HierarchyObject)node.GetService(typeof(IMenuHandler));

                MenuItem item = new MenuItem();
                _tableMenu.AddChild(string.Empty, item);
            }
        }
Example #3
0
        private void Provider_SelectionChanged(object sender, NodesChangedEventArgs args)
        {
            INavigationContextProvider provider = (INavigationContextProvider)sender;
            INodeInformation node = (args.ChangedNodes.Count > 0 ? args.ChangedNodes[0] : null);

            if (_tableMenu == null &&
                _tableRegex.IsMatch(node.Context))
            {
                _tableMenu = (HierarchyObject)node.GetService(typeof(IMenuHandler));

                MenuItem item = new MenuItem();
                _tableMenu.AddChild(string.Empty, item);
            }
        }
Example #4
0
        private void Provider_SelectionChanged(object sender, NodesChangedEventArgs args)
        {
            Connect.ViewsSelected = false;
            INodeInformation node = Connect.ObjectExplorerSelectedNode;

            if (node != null)
            {
                System.Diagnostics.Debug.WriteLine(node.UrnPath);
                System.Diagnostics.Debug.WriteLine(node.Name);
                System.Diagnostics.Debug.WriteLine(node.Context);
                // Mobile Device connections not supported
                if (node.Connection.ServerName.StartsWith("Mobile Device\\", StringComparison.Ordinal))
                {
                    // short circuit
                    node = null;
                }
            }

            if (node != null && _serverMenu == null &&
                urnPath == node.UrnPath)
            {
                _serverMenu = (HierarchyObject)node.GetService(typeof(IMenuHandler));

                _serverMenu.AddChild(string.Empty, new ToolStripSeparatorMenuItem());
                DatabaseMenuItem item = new DatabaseMenuItem();
                _serverMenu.AddChild(string.Empty, item);
                ServerMenuItem serveritem = new ServerMenuItem();
                _serverMenu.AddChild(string.Empty, serveritem);
            }

            if (node != null && _tableMenu == null &&
                tableUrnPath == node.UrnPath)
            {
                _tableMenu = (HierarchyObject)node.GetService(typeof(IMenuHandler));

                _tableMenu.AddChild(string.Empty, new ToolStripSeparatorMenuItem());
                EditTableMenuItem itemE = new EditTableMenuItem();
                _tableMenu.AddChild(string.Empty, itemE);

                _tableMenu.AddChild(string.Empty, new ToolStripSeparatorMenuItem());
                ScriptTableMenuItem item = new ScriptTableMenuItem();
                _tableMenu.AddChild(string.Empty, item);

                _tableMenu.AddChild(string.Empty, new ToolStripSeparatorMenuItem());
                ImportTableMenuItem item2 = new ImportTableMenuItem();
                _tableMenu.AddChild(string.Empty, item2);

                _tableMenu.AddChild(string.Empty, new ToolStripSeparatorMenuItem());
                RenameTableMenuItem item3 = new RenameTableMenuItem();
                _tableMenu.AddChild(string.Empty, item3);
            }

            if (node != null && _indexMenu == null && indexUrnPath == node.UrnPath)
            {
                _indexMenu = (HierarchyObject)node.GetService(typeof(IMenuHandler));

                _indexMenu.AddChild(string.Empty, new ToolStripSeparatorMenuItem());
                ScriptIndexMenuItem itemI = new ScriptIndexMenuItem();
                _indexMenu.AddChild(string.Empty, itemI);
            }

            if (node != null && _viewMenu == null &&
                viewUrnPath == node.UrnPath)
            {
                _viewMenu = (HierarchyObject)node.GetService(typeof(IMenuHandler));

                _viewMenu.AddChild(string.Empty, new ToolStripSeparatorMenuItem());
                EditTableMenuItem itemV = new EditTableMenuItem();
                _viewMenu.AddChild(string.Empty, itemV);
            }

            // Set this each time
            if (node != null && viewUrnPath == node.UrnPath)
            {
                Connect.ViewsSelected = true;
            }
        }
Example #5
0
        private void Provider_SelectionChanged(object sender, NodesChangedEventArgs args)
        {
            Connect.ViewsSelected = false;
            INodeInformation node = Connect.ObjectExplorerSelectedNode;
            if (node != null)
            {
                System.Diagnostics.Debug.WriteLine(node.UrnPath);
                System.Diagnostics.Debug.WriteLine(node.Name);
                System.Diagnostics.Debug.WriteLine(node.Context);
                // Mobile Device connections not supported
                if (node.Connection.ServerName.StartsWith("Mobile Device\\", StringComparison.Ordinal))
                {
                    // short circuit
                    node = null;
                }
            }

            if (node != null && _serverMenu == null &&
                urnPath == node.UrnPath)
            {
                _serverMenu = (HierarchyObject)node.GetService(typeof(IMenuHandler));
                
                _serverMenu.AddChild(string.Empty, new ToolStripSeparatorMenuItem());
                DatabaseMenuItem item = new DatabaseMenuItem();
                _serverMenu.AddChild(string.Empty, item);
                ServerMenuItem serveritem = new ServerMenuItem();
                _serverMenu.AddChild(string.Empty, serveritem);
            }

            if (node != null && _tableMenu == null &&
                tableUrnPath == node.UrnPath)
            {
                _tableMenu = (HierarchyObject)node.GetService(typeof(IMenuHandler));

                _tableMenu.AddChild(string.Empty, new ToolStripSeparatorMenuItem());
                EditTableMenuItem itemE = new EditTableMenuItem();
                _tableMenu.AddChild(string.Empty, itemE);

                _tableMenu.AddChild(string.Empty, new ToolStripSeparatorMenuItem());
                ScriptTableMenuItem item = new ScriptTableMenuItem();
                _tableMenu.AddChild(string.Empty, item);

                _tableMenu.AddChild(string.Empty, new ToolStripSeparatorMenuItem());
                ImportTableMenuItem item2 = new ImportTableMenuItem();
                _tableMenu.AddChild(string.Empty, item2);

                _tableMenu.AddChild(string.Empty, new ToolStripSeparatorMenuItem());
                RenameTableMenuItem item3 = new RenameTableMenuItem();
                _tableMenu.AddChild(string.Empty, item3);
            }

            if (node != null && _indexMenu == null && indexUrnPath == node.UrnPath)
            {
                _indexMenu = (HierarchyObject)node.GetService(typeof(IMenuHandler));

                _indexMenu.AddChild(string.Empty, new ToolStripSeparatorMenuItem());
                ScriptIndexMenuItem itemI = new ScriptIndexMenuItem();
                _indexMenu.AddChild(string.Empty, itemI);
            }

            if (node != null && _viewMenu == null &&
                    viewUrnPath == node.UrnPath)
            {
                _viewMenu = (HierarchyObject)node.GetService(typeof(IMenuHandler));

                _viewMenu.AddChild(string.Empty, new ToolStripSeparatorMenuItem());
                EditTableMenuItem itemV = new EditTableMenuItem();
                _viewMenu.AddChild(string.Empty, itemV);
            }

            // Set this each time
            if (node != null && viewUrnPath == node.UrnPath)
            {
                Connect.ViewsSelected = true;
            }
            
        }
Example #6
0
 private void AddMenuItemToHierarchyObject(INodeInformation node, object item)
 {
     dbMenu = (HierarchyObject)node.GetService(typeof(IMenuHandler));
     dbMenu.AddChild(string.Empty, item);
 }