× Heads up!

Aqua Data Studio / nhilam

Follow
IDE for Relational Databases
×
kin-hong reported 2017-08-09T17:40:30Z  · tomconrad last modified 2018-03-15T17:42:33Z

Detail Pane context menu enhancement: Add selected context menu items from schema tree node


PM
Priority Low
Complexity Unknown
Component App - Schema Browser
Version Future

Add selected context menu items that are currently shown in the schema tree node to the corresponding object's context menu in the Detail Pane.  For now, all menu items from the top to "Scripting Options" (not inclusive) will be shown.  See attached screenshot.

The approach to implementing this feature is to reuse as much as possible the existing schema tree node context menu building logic and menu item actions; many of these are database-specific or even database-version-specific. Here are a few design notes:

1. The context menu building and menu item actions are closely tied to the "selected" node on the schema tree. For instance, on the schema tree, to obtain the context menu of the "orders" table, the "Tables" folder needs to be expanded and the "orders" table selected.

2. However, the detail pane contents are shown when the parent container node is selected. With the above example, when the "Tables" node selected, the detail pane is populated with the tables. When the detail pane's "orders" row is right-clicked, we need to make the schema tree code know that the "selected" node is actually the "orders" child node of the "Tables" folder (although the "Tables" folder node remains to be displayed as selected on the schema tree).

To achieve the above, I introduced the concept of action node. The action node is passed via the ActionEvent (generated when the menu item action is invoked). I refactored the schema tree context menu building logic and menu item actions to work with the action node instead of the selected node. When a row in the detail pane is right-clicked, the corresponding schema tree child node (e.g. the "orders" node) is set up as the action node (even though the "selected" node is still the "Tables" folder node).

Below are a few implementation details:

1. A pass to reduce the schema tree code dependence on "selected" node is made. Specifically, the passing and keeping schema tree node references have been reduced. For example, the original CEditorPanelView#setLastFolder(CTreeNode) actually just gets the connection properties from the tree node. It has been refactored to CEditorPanelView#setLastFolder(ConnectionProperties) - i.e. tree nodes are no longer passed around.

2. When a user selects a schema tree node, the CTreeNode#getDetailView method is called. The CTreeNode#asTable has been updated so that when a user right clicks on a row in the detail pane, the new CTreeNode#setupDetailPopupMenu will be called. This is the main method where the detail pane row object (e.g. "orders") is matched with the selected (e.g. "Tables") schema tree node's list of child nodes.
 
3. CTreeNode#isSameAs method is added to aid the matching. Selected properties from the detail pane row object (obtained from database "extract" code) are compared with the corresponding properties of the child schema tree node. Often, when a detail pane context menu does not show the scripting menu items of the corresponding schema tree context menu, the schema tree node is missing an appropriate CTreeNode#isSameAs override.
 
4. The new CFrameUtil#getActionTreeNode utility method is added. The <DatabaseObject>NodeInfo classes have been changed/refactored to use the action node. For example, see com.aquafold.datastudio.mainframe.actions.tree.ProcedureNodeInfo.java. The action classes under the com.aquafold.datastudio.mainframe.actions.tree package have been refactored to call <DatabaseObject>NodeInfo.getNodeInfo with the action event so that the action node can be retrieved.
 
5. To merge only selected menu items from the schema tree node context menu to the detail pane context menu, a new tag class MultiCtxMenuItem (stands for "Multiple Context Menu Item") has been created. This class should be used to construct the menu item if the item also needs to be shown in the detail pane. The schema tree menu building code has been updated accordingly with MultiCtxMenuItem.
 
6. [TBD] In step 2, the parent schema node's getNodeList method is invoked to retrieve its children. This is a threaded operation in the schema tree code. To avoid pause in displaying the detail pane context menu, this operation should also be threaded in CTreeNode#setupDetailPopupMenu. Also, the children nodes should be cached for the subsequent object row right-clicked, currently it is re-invoking getNodeList.
1 attachment

Issue #15435

New
 
 
Completion
No due date
No fixed build
No time estimate

About AquaClusters Privacy Policy Support Version - 19.0.2-4 AquaFold, Inc Copyright © 2007-2017