예제 #1
0
        void DBView_ItemDoubleClick(object sender, MetadataStructureItem clickedItem)
        {
            if (clickedItem.MetadataItem == null)
            {
                return;
            }

            // Adding a table to the currently active query.
            if ((MetadataType.Objects & clickedItem.MetadataItem.Type) == 0 &&
                (MetadataType.ObjectMetadata & clickedItem.MetadataItem.Type) == 0)
            {
                return;
            }
            if (ActiveMdiChild == null)
            {
                ChildForm childWindow = CreateChildForm();
                if (childWindow == null)
                {
                    return;
                }
                childWindow.Show();
                childWindow.Activate();
            }
            ChildForm window = (ChildForm)ActiveMdiChild;

            if (window == null)
            {
                return;
            }
            MetadataItem metadataItem = clickedItem.MetadataItem;

            if (metadataItem == null)
            {
                return;
            }
            if ((metadataItem.Type & MetadataType.Objects) <= 0 && metadataItem.Type != MetadataType.Field)
            {
                return;
            }
            using (var qualifiedName = metadataItem.GetSQLQualifiedName(null, true))
            {
                window.QueryView.AddObjectToActiveUnionSubQuery(qualifiedName.GetSQL());
            }
        }