Example #1
0
        private void DoKeyUp(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.Delete:
                // DeleteObject()
                e.Handled          = true;
                e.SuppressKeyPress = true;
                break;

            case Keys.Enter:
                if (tree.SelectedNode != null)
                {
                    SchemataNode node = (SchemataNode)tree.SelectedNode;
                    node.DoDefaultAction();
                    e.Handled          = true;
                    e.SuppressKeyPress = true;
                }
                break;

            default:
                e.Handled = false;
                break;
            }
        }
Example #2
0
        private void DoMouseDown(object sender, MouseEventArgs e)
        {
            // Node might not be a SchemataNode if the "Discovering..." node is
            // displayed and the user tried to click it before discovery completes

            TreeNode rawnode = tree.GetNodeAt(e.X, e.Y);

            if ((rawnode == null) || !(rawnode is SchemataNode))
            {
                return;
            }

            SchemataNode node = (SchemataNode)rawnode;

            if (e.Button == MouseButtons.Left)
            {
                // for some reason, tree doesn't assume focus when you return to the
                // control with a left click.  So let's force it here.
                tree.Focus();

                tree.SelectedNode = node;

                if (node.CanDrag)
                {
                    int    i    = node.Text.IndexOf(" ");
                    string text = (i < 0 ? node.Text : node.Text.Substring(0, i));

                    tree.DoDragDrop(text, DragDropEffects.Copy);
                }
            }
            else if (e.Button == MouseButtons.Right)
            {
                tree.SelectedNode = node;

                //if (node.CanOpen || node.CanEdit || node.CanDelete
                //    || node.CanRefresh || node.CanCompile || node.CanDescribe)
                {
                    if (node.CanDescribe)
                    {
                        treeMenu.Items[1].Image = menuIcons.Images[1];
                        treeMenu.Items[1].Text  = translator.GetString("ScriptContextMenu");
                    }
                    else
                    {
                        treeMenu.Items[1].Image = menuIcons.Images[0];
                        treeMenu.Items[1].Text  = translator.GetString("EditContextMenu");
                    }

                    treeMenu.Items[0].Enabled = node.CanOpen;
                    treeMenu.Items[1].Enabled = node.CanEdit || node.CanDescribe;
                    treeMenu.Items[2].Enabled = node.CanCompile;
                    treeMenu.Items[3].Enabled = node.CanDelete;
                    treeMenu.Items[4].Enabled = node.CanRename;
                    treeMenu.Items[7].Enabled = node.CanRefresh;
                }
            }
        }
Example #3
0
        private void DoRename(object sender, EventArgs e)
        {
            SchemataNode node = (SchemataNode)tree.SelectedNode;

            if (node.CanRename)
            {
                tree.LabelEdit = true;
                tree.SelectedNode.BeginEdit();
            }
        }
Example #4
0
 private void DoAfterLabelEdit(object sender, NodeLabelEditEventArgs e)
 {
     if (e.Label != null)
     {
         SchemataNode node = (SchemataNode)tree.SelectedNode;
         node.Rename(e.Label);
         node.Text      = e.Label.ToUpper();
         tree.LabelEdit = false;
     }
 }
Example #5
0
        //========================================================================================
        // Constructor
        //		Public type constructor.  The default base constructor will be called
        //		implicitly, which, in turn, will call our Configure factory method.
        //========================================================================================

        internal SchemataColumn(DatabaseConnection dbase, SchemataNode srvnode, string text)
        {
            this.dbase      = dbase;
            this.srvnode    = srvnode;
            this.schemaName = srvnode.SchemaName;
            this.canDelete  = true;
            this.canDrag    = true;
            this.canRename  = true;

            Text       = text;
            ImageIndex = SelectedImageIndex = SchemaIcons.Column;
        }
Example #6
0
        //========================================================================================
        // Constructor
        //		Public type constructor.  The default base constructor will be called
        //		implicitly, which, in turn, will call our Configure factory method.
        //========================================================================================

        internal SchemataSynonym(DatabaseConnection dbase, SchemataNode srvnode, string text)
        {
            this.dbase      = dbase;
            this.srvnode    = srvnode;
            this.schemaName = srvnode.SchemaName;

            this.canDescribe = false;
            this.canDelete   = true;
            this.canDrag     = true;

            Text       = text;
            ImageIndex = SelectedImageIndex = SchemaIcons.Synonym;
        }
Example #7
0
        //========================================================================================
        // Constructor
        //		Public type constructor.  The default base constructor will be called
        //		implicitly, which, in turn, will call our Configure factory method.
        //========================================================================================

        internal SchemataPackageBody(DatabaseConnection dbase, SchemataNode srvnode, string text)
        {
            this.dbase      = dbase;
            this.srvnode    = srvnode;
            this.schemaName = srvnode.SchemaName;

            this.canCompile = true;
            this.canDelete  = true;
            this.canEdit    = true;
            this.canDrag    = true;

            Text       = text;
            ImageIndex = SelectedImageIndex = SchemaIcons.Package;
        }
Example #8
0
        //========================================================================================
        // Constructor
        //		Public type constructor.  The default base constructor will be called
        //		implicitly, which, in turn, will call our Configure factory method.
        //========================================================================================

        internal SchemataSequence(DatabaseConnection dbase, SchemataNode srvnode, string text)
        {
            this.dbase      = dbase;
            this.srvnode    = srvnode;
            this.schemaName = srvnode.SchemaName;

            this.canDelete   = true;
            this.canDescribe = true;
            this.canDrag     = true;
            this.canRename   = true;

            this.Text       = text;
            this.ImageIndex = this.SelectedImageIndex = SchemaIcons.Sequence;
        }
Example #9
0
        private void DoBeforeExpand(object sender, TreeViewCancelEventArgs e)
        {
            if (e.Node is SchemataNode)
            {
                // TODO: LockWindow();

                SchemataNode node = (SchemataNode)e.Node;
                if (node.HasDiscovery && !node.IsDiscovered)
                {
                    node.Discover();
                }

                toggling = true;
            }
        }
Example #10
0
        //========================================================================================
        // Constructor
        //		Public type constructor.  The default base constructor will be called
        //		implicitly, which, in turn, will call our Configure factory method.
        //========================================================================================

        internal SchemataConstraint(
            DatabaseConnection dbase, SchemataNode srvnode,
            string text, SchemataTypes type)
        {
            this.dbase      = dbase;
            this.srvnode    = srvnode;
            this.schemaName = srvnode.SchemaName;

            this.canDelete   = true;
            this.canDrag     = true;
            this.canDescribe = true;

            Text       = text;
            ImageIndex = SelectedImageIndex = SchemaIcons.CheckConstraint;
        }
Example #11
0
        //========================================================================================
        // Constructor
        //		Public type constructor.  The default base constructor will be called
        //		implicitly, which, in turn, will call our Configure factory method.
        //========================================================================================

        public SchemataParameter(
            DatabaseConnection dbase, SchemataNode srvnode, string text,
            string argumentName, string typeName, ParameterDirection direction)
        {
            this.dbase      = dbase;
            this.srvnode    = srvnode;
            this.schemaName = srvnode.SchemaName;
            this.canDrag    = true;

            this.name      = argumentName;
            this.typeName  = typeName;
            this.direction = direction;

            Text       = text;
            ImageIndex = SelectedImageIndex = SchemaIcons.ParameterIn;
        }
Example #12
0
        //========================================================================================
        // Constructor
        //		Public type constructor.  The default base constructor will be called
        //		implicitly, which, in turn, will call our Configure factory method.
        //========================================================================================

        internal SchemataColumnFolder(DatabaseConnection dbase, SchemataNode srvnode)
        {
            this.dbase      = dbase;
            this.srvnode    = srvnode;
            this.schemaName = srvnode.SchemaName;

            this.canRefresh   = true;
            this.hasDiscovery = true;

            Text       = "Columns";
            ImageIndex = SelectedImageIndex = SchemaIcons.FolderClose;

            Nodes.Add(new TreeNode("Discovering..."));

            this.AddProperty(translator.GetString("PColumnFolderName"), Text);
            this.AddProperty(translator.GetString("PColumnFolderType"), "OraColumn Folder");
        }
Example #13
0
        //========================================================================================
        // Constructor
        //		Public type constructor.  The default base constructor will be called
        //		implicitly, which, in turn, will call our Configure factory method.
        //========================================================================================

        internal SchemataSequenceFolder(DatabaseConnection dbase, SchemataNode srvnode)
        {
            this.dbase      = dbase;
            this.srvnode    = srvnode;
            this.schemaName = srvnode.SchemaName;

            this.canRefresh   = true;
            this.hasDiscovery = true;

            Text       = "Sequences";
            ImageIndex = SelectedImageIndex = SchemaIcons.FolderClose;

            Nodes.Add(new TreeNode("Discovering..."));

            this.AddProperty("Name", Text);
            this.AddProperty("Type", "Sequence Folder");
        }
Example #14
0
        //========================================================================================
        // Constructor
        //		Public type constructor.  The default base constructor will be called
        //		implicitly, which, in turn, will call our Configure factory method.
        //========================================================================================

        internal SchemataView(DatabaseConnection dbase, SchemataNode srvnode, string text)
        {
            this.dbase      = dbase;
            this.srvnode    = srvnode;
            this.schemaName = srvnode.SchemaName;

            this.canDelete = true;
            this.canEdit   = true;
            this.canOpen   = true;
            this.canDrag   = true;
            this.canRename = true;

            Text       = text;
            ImageIndex = SelectedImageIndex = SchemaIcons.View;

            Nodes.Add(new SchemataColumnFolder(dbase, srvnode));
            Nodes.Add(new SchemataIndexFolder(dbase, srvnode));
        }
Example #15
0
        //========================================================================================
        // Constructor
        //		Public type constructor.  The default base constructor will be called
        //		implicitly, which, in turn, will call our Configure factory method.
        //========================================================================================

        internal SchemataType(
            DatabaseConnection dbase, SchemataNode srvnode, string text)
        {
            this.dbase      = dbase;
            this.srvnode    = srvnode;
            this.schemaName = srvnode.SchemaName;

            this.canDelete = true;
            this.canEdit   = true;
            this.canDrag   = true;
            this.canRename = true;

            Text = text;

            ImageIndex = SelectedImageIndex = SchemaIcons.Type;

            //Nodes.Add(new SchemataTypeBody(dbase, srvnode));
        }
Example #16
0
        //========================================================================================
        // Constructor
        //		Public type constructor.  The default base constructor will be called
        //		implicitly, which, in turn, will call our Configure factory method.
        //========================================================================================

        internal SchemataPackage(DatabaseConnection dbase, SchemataNode srvnode, string text)
        {
            this.dbase      = dbase;
            this.srvnode    = srvnode;
            this.schemaName = srvnode.SchemaName;

            this.canCompile   = true;
            this.canDelete    = true;
            this.canEdit      = true;
            this.canRefresh   = true;
            this.hasDiscovery = true;
            this.canDrag      = true;

            Text       = text;
            ImageIndex = SelectedImageIndex = SchemaIcons.Package;

            Nodes.Add(new TreeNode());
        }
Example #17
0
        //========================================================================================
        // Constructor
        //		Public type constructor.  The default base constructor will be called
        //		implicitly, which, in turn, will call our Configure factory method.
        //========================================================================================

        internal SchemataTriggerFolder(DatabaseConnection dbase, SchemataNode srvnode)
        {
            this.dbase      = dbase;
            this.srvnode    = srvnode;
            this.schemaName = srvnode.SchemaName;

            this.restrictions = null;

            this.canRefresh   = true;
            this.hasDiscovery = true;

            Text       = translator.GetString("TriggersLabel");
            ImageIndex = SelectedImageIndex = SchemaIcons.FolderClose;

            Nodes.Add(new TreeNode("Discovering..."));

            this.AddProperty("Name", Text);
            this.AddProperty("Type", translator.GetString("TriggerFolderLabel"));
        }
Example #18
0
        //========================================================================================
        // Constructor
        //		Public type constructor.  The default base constructor will be called
        //		implicitly, which, in turn, will call our Configure factory method.
        //========================================================================================

        internal SchemataFunction(DatabaseConnection dbase, SchemataNode srvnode, string text)
        {
            this.dbase      = dbase;
            this.srvnode    = srvnode;
            this.schemaName = srvnode.SchemaName;

            // Restrictions: Owner, Name
            this.restrictions = new string[] { schemaName, text };

            this.canDelete    = true;
            this.canEdit      = true;
            this.canRefresh   = true;
            this.canDrag      = true;
            this.hasDiscovery = true;

            Text       = text;
            ImageIndex = SelectedImageIndex = SchemaIcons.Function;

            Nodes.Add(new TreeNode());
        }
Example #19
0
        //========================================================================================
        // Constructor
        //		Public type constructor.  The default base constructor will be called
        //		implicitly, which, in turn, will call our Configure factory method.
        //========================================================================================

        internal SchemataTrigger(DatabaseConnection dbase, SchemataNode srvnode, string text)
        {
            this.dbase      = dbase;
            this.srvnode    = srvnode;
            this.schemaName = srvnode.SchemaName;

            this.restrictions = null;

            this.hasDiscovery = true;
            this.canCompile   = true;
            this.canEdit      = true;
            this.canDrag      = true;

            Text       = text;
            ImageIndex = SelectedImageIndex = SchemaIcons.Trigger;

            this.overload = 0;

            Nodes.Add(new TreeNode());
        }
Example #20
0
        private void DoEdit(object sender, EventArgs e)
        {
            if (Editing != null)
            {
                SchemataNode node = (SchemataNode)tree.SelectedNode;
                if (node.IsWrapped)
                {
                    MessageBox.Show(
                        "Unable to edit.  Contents are wrapped.",
                        "Wrapped Content",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Information
                        );

                    return;
                }

                Editing(new BrowserTreeEventArgs(
                            BrowserTreeAction.Edit, (SchemataNode)tree.SelectedNode));
            }
        }
Example #21
0
        private void DoDelete(object sender, EventArgs e)
        {
            SchemataNode node = (SchemataNode)tree.SelectedNode;

            DialogResult result = MessageBox.Show(
                String.Format(translator.GetString("ConfirmDeleteMessage"), node.Text),
                translator.GetString("ConfirmDeleteTitle"),
                MessageBoxButtons.YesNo,
                MessageBoxIcon.Warning
                );

            if (result == DialogResult.Yes)
            {
                SchemataNode parent = (SchemataNode)node.Parent;

                TreeNode next = null;
                if (tree.SelectedNode.NextNode != null)
                {
                    next = tree.SelectedNode.NextNode;
                }
                else if (tree.SelectedNode.PrevNode != null)
                {
                    next = tree.SelectedNode.PrevNode;
                }
                else
                {
                    next = parent;
                }

                if (node.Delete())
                {
                    if (next != null)
                    {
                        tree.SelectedNode = next;
                    }
                }
            }
        }
Example #22
0
        protected SchemataNode()
        {
            this.dbase                = null;
            this.schemaName           = null;
            this.restrictions         = null;
            this.srvnode              = null;
            this.properties           = new HybridDictionary();
            this.propertyDescriptions = null;

            this.canCompile   = false;
            this.canDelete    = false;
            this.canDescribe  = false;
            this.canEdit      = false;
            this.canOpen      = false;
            this.canRefresh   = false;
            this.canRename    = false;
            this.canDrag      = false;
            this.hasDetails   = false;
            this.hasDiscovery = false;
            this.isDiscovered = false;
            this.isWrapped    = false;

            translator = new Translator("Browser");
        }
Example #23
0
        //========================================================================================
        // Constructor
        //		Public type constructor.  The default base constructor will be called
        //		implicitly, which, in turn, will call our Configure factory method.
        //========================================================================================

        internal SchemataTable(
            DatabaseConnection dbase, SchemataNode srvnode,
            string text, string objectType)
        {
            this.dbase      = dbase;
            this.srvnode    = srvnode;
            this.schemaName = srvnode.SchemaName;

            this.canDelete   = true;
            this.canDescribe = objectType.Equals("TABLE", StringComparison.InvariantCultureIgnoreCase);
            this.canOpen     = true;
            this.canDrag     = true;
            this.canRename   = true;

            Text = text;

            ImageIndex
                  = SelectedImageIndex
                  = this.canDescribe ? SchemaIcons.Table : SchemaIcons.SystemTable;

            Nodes.Add(new SchemataColumnFolder(dbase, srvnode));
            Nodes.Add(new SchemataConstraintFolder(dbase, srvnode));
            Nodes.Add(new SchemataIndexFolder(dbase, srvnode));
        }
Example #24
0
 public SchemaItem(SchemataSchema node)
 {
     this.node = node;
     this.text = node.Parent.Text + "." + node.Text;
 }
Example #25
0
 public BrowserTreeEventArgs(BrowserTreeAction action, SchemataNode node)
 {
     this.action = action;
     this.node   = node;
 }