コード例 #1
0
ファイル: main.objecttrees.cs プロジェクト: fence-post/sqrach
        private void tableContextMenu_Opening(object sender, CancelEventArgs e)
        {
            ObjectsTreeView tree = focusedTree = allObjectsTree.tree.Focused ? allObjectsTree.tree : activeObjectsTree.tree;

            bool clickedOnSelected = tree.NodeAtLocationIsSelected(tree.PointToClient(Cursor.Position));
            bool objectsSelected   = false;

            if (clickedOnSelected)
            {
                objectsSelected = tree.GetSelectedColumns().Count > 0 || tree.GetSelectedTables().Count > 0;
            }
            T.Debug("clicked on selected=" + (clickedOnSelected ? "yes" : "no"));

            bool isActiveObjectsTree = focusedTree == activeObjectsTree.tree;

            showDataToolStripMenuItem.Enabled       = background.busy == false && tree.GetSelectedTables().Count == 1 && tree.GetSelectedColumns().Count == 0;
            addToToolStripMenuItem.Enabled          = selectFromToolStripMenuItem.Enabled = objectsSelected;
            addToWorkspaceToolStripMenuItem.Visible = !isActiveObjectsTree;
            stickyToolStripMenuItem.Visible         = isActiveObjectsTree;
            showAllColumnsToolStripMenuItem.Visible = isActiveObjectsTree && focusedTree.OnlyTablesAreSelected();
            recentAtTopToolStripMenuItem.Checked    = S.Get("recentObjectsAtTop", false);
            int selectedSticky = tree.AreSelectedObjectsSticky();

            stickyToolStripMenuItem.Checked         = selectedSticky >= 0;
            addToWorkspaceToolStripMenuItem.Checked = selectedSticky > 0;
            collapseAllToolStripMenuItem.Enabled    = !focusedTree.AllRootNodesCollapsed();
            expandToolStripMenuItem.Enabled         = !focusedTree.AllRootNodesExpanded();
            if (focusedTree.OnlyTablesAreSelected())
            {
                showAllColumnsToolStripMenuItem.Checked = focusedTree.SelectedTablesAreShowAllColumns();
            }
            stickyToolStripMenuItem.Enabled         = objectsSelected;
            addToWorkspaceToolStripMenuItem.Enabled = objectsSelected;
            showAllColumnsToolStripMenuItem.Enabled = objectsSelected;
        }
コード例 #2
0
ファイル: main.objecttrees.cs プロジェクト: fence-post/sqrach
 private void selectFromToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ShowNewQueryDialog(focusedTree.GetSelectedTables(), focusedTree.GetSelectedColumns());
 }