public void ExecuteCommandLine() { string s = CommandLineControl.Text; if (s == "") { return; } HideQuickSearchPopup(); DevExpress.XtraEditors.Controls.MRUEditItemCollection items = CommandLineControl.Properties.Items; if (items.Count > 0 && Lex.Eq(items[0].ToString(), s)) { } // don't insert same item again else { CommandLineControl.Properties.Items.Insert(0, s); // insert in list manually since we clear it here } CommandLineControl.Text = ""; PreviousInput = ""; // avoid any additional QuickDisplays QbUtil.CallCurrentProcessTreeItemOperationMethod("CommandLine", s); //CommandExec.Execute("CommandLine " + s); }
/// <summary> /// Handle special KeyDown events /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CommandLine_KeyDown(object sender, KeyEventArgs e) { LastCommandLineControlKeyDownTime = DateTime.Now; if (CheckForEscapePressed(e)) { } else if (e.KeyCode == Keys.Enter) // command entered { e.Handled = true; ExecuteCommandLine(); return; #if false // experimental code that opens the currently selected item in the dropdown rather than doing a more-complete search int i1 = ListControl.SelectedIndex; if (ListControl.Visible && i1 >= 0 && // something selected i1 < MatchingContentsNodes.Count) // within list of nodes found in the latest quicksearch { MetaTreeNode mtn = MatchingContentsNodes[i1]; QbUtil.CallCurrentProcessTreeItemOperationMethod("Open", mtn.Target); HideQuickSearchPopup(); } else { ExecuteCommandLine(); // just execute the command line } return; #endif } }
private void ListControl_MouseDown(object sender, MouseEventArgs e) { //ClientLog.Message("Down " + ListControl.SelectedIndex); int i1 = ListControl.SelectedIndex; // e.Y / ListControl.ItemHeight; if (i1 >= MatchingContentsNodes.Count) { return; // selected elipsis } MetaTreeNode mtn = MatchingContentsNodes[i1]; if (e.Button == MouseButtons.Left) // immediate action { QbUtil.CallCurrentProcessTreeItemOperationMethod("Open", mtn.Target); //MainMenuControl.OpenMetaTreeNodeObject(mtn); HideQuickSearchPopup(); } else // right button click, show menu { QbContentsTree treeCtl = SessionManager.Instance.MainContentsControl; treeCtl.CurrentContentsMetaTreeNode = mtn; treeCtl.CurrentContentsTreeListNode = null; // tree list node not known ActiveContextMenu = treeCtl.ContentsTreeContextMenus.GetSingleNodeContextMenu(mtn); if (ActiveContextMenu != null) { ActiveContextMenu.Show(ListControl, new System.Drawing.Point(e.X, e.Y)); while (ActiveContextMenu != null && ActiveContextMenu.Visible) // keep this visible as long as popup is visible { System.Threading.Thread.Sleep(250); Application.DoEvents(); } HideQuickSearchPopup(); } } return; }
private void ContentsTree_MouseDown(object sender, MouseEventArgs e) { CurrentContentsTreeMouseDownEvent = e; // save event info for later use MetaTreeNode mtn = ContentsTreeCtl.GetMetaTreeNodeAt(ContentsTreeCtl.PointToClient(Cursor.Position), out CurrentContentsTreeListNode); if (mtn == null || mtn.Target == null) { return; } CurrentContentsMetaTreeNode = mtn; if (MouseDown != null) // if overridden, call the method { MouseDown(sender, e); return; } else { QbUtil.CallCurrentProcessTreeItemOperationMethod("Open", mtn.Target); // no popup menus for now, just process as default open operation } return; }
/// <summary> /// Open the specified target /// </summary> /// <param name="mtn"></param> public static void OpenMetaTreeNode( MetaTreeNode mtn) { UserObject uo; string tok; int i1; if (mtn == null) { return; } MetaTreeNodeType nodeType = mtn.Type; string target = mtn.Target; //if (!Permissions.UserHasReadAccess(SS.I.UserName, target)) //{ // MessageBoxMx.ShowError("You are not authorized to open: " + mtn.Label); // return; //} if (nodeType == MetaTreeNodeType.MetaTable || // data table types nodeType == MetaTreeNodeType.CalcField || nodeType == MetaTreeNodeType.CondFormat || nodeType == MetaTreeNodeType.Annotation || nodeType == MetaTreeNodeType.ResultsView) { QbUtil.CallCurrentProcessTreeItemOperationMethod("Open", target); } else if (MetaTreeNode.IsFolderNodeType(nodeType)) { if (Lex.StartsWith(target, "USERDATABASE_")) // edit a user compound database { uo = ParseAndReadUserObject(target); if (uo == null) { return; } UserData.OpenExistingUserDatabase(uo); } } else if (nodeType == MetaTreeNodeType.Url) { // open url or execute click function if ((i1 = Lex.IndexOf(target, "ClickFunction")) >= 0) { string cmd = target.Substring(i1 + "ClickFunction".Length + 1); // get function name ClickFunctions.Process(cmd, null); } else if (Lex.Contains(target, "SpotfireWeb")) // link to Spotfire webplayer { SpotfireLinkUI.OpenLink(target); } else { SystemUtil.StartProcess(target); // open in default user browser } } else if (nodeType == MetaTreeNodeType.Action) { // execute action return; // CommandLineControl.Execute(mtn.Target); } else if (nodeType == MetaTreeNodeType.CnList) // open list { uo = ParseAndReadUserObject(target); if (uo == null) { return; } tok = uo.InternalName; CidListEditor.Edit(tok); } else if (nodeType == MetaTreeNodeType.Query) // open query { uo = ParseAndReadUserObject(target); if (uo == null) { return; } if (uo.Type == UserObjectType.Query) // normal query { tok = uo.InternalName; string nextCommand = QbUtil.OpenQuery(tok); while (!(String.IsNullOrEmpty(nextCommand))) { nextCommand = CommandExec.ExecuteCommand(nextCommand); } } else if (uo.Type == UserObjectType.MultiTable) // multitable query { QbUtil.AddAndRenderTables(target); } } else if (nodeType == MetaTreeNodeType.Library) { CommandExec.ExecuteCommandAsynch("ContentsViewLibAsList " + mtn.Name); } }