private void goToType(ITypeCache cache, Editor editor) { _ctx.Post((s) => { if (_gotoType == null || !_gotoType.Visible) { _gotoType = new TypeSearchForm( cache, (file, line, column) => { editor.GoTo(file, line, column); }, () => { new System.Threading.Thread(() => { System.Threading.Thread.Sleep(1000); editor.SetFocus(); }).Start(); }); _gotoType.Show(this); } setToForeground(_gotoType); }, null); }
private void explore(ITypeCache cache, Editor editor) { _ctx.Post((s) => { if (_exploreForm == null || !_exploreForm.Visible) { _exploreForm = new FileExplorer( cache, _defaultLanguage, (file, line, column) => { editor.GoTo(file, line, column); }, () => { editor.SetFocus(); }); _exploreForm.Show(this); } setToForeground(_exploreForm); }, null); }
private void userSelect(MessageArgs message, Editor editor) { var state = new ConfigReader(_endpoint.Token).Get("oi.userselect.ui.fallback"); if (state == "disabled") return; _ctx.Post((s) => { try { var args = new CommandStringParser().Parse(message.Message).ToArray(); var items = new List<string>(); var keys = new List<string>(); foreach (var item in args[3].Split(new[] {','})) { var chunks = item.Split(new[] {"||"}, StringSplitOptions.None); if (chunks.Length > 1) { keys.Add(chunks[0]); items.Add(chunks[1]); } else { keys.Add(item); items.Add(item); } } var command = "user-selected"; if (message.Message.StartsWith("user-select-at-caret ")) command = "user-selected-at-caret"; var form = new UserSelectForm(items, keys, (item) => { if (item != null) _endpoint.PublishEvent(command+" '" + args[2] + "' '" + item + "'"); else _endpoint.PublishEvent(command+" '" + args[2] + "' 'user-cancelled'"); editor.SetFocus(); }); form.Show(this); setToForeground(form); } catch { } }, null); }
private void goToType(ITypeCache cache, Editor editor) { Logger.Write("Preparing to open type search"); _ctx.Post((s) => { Logger.Write("Opening type search"); try { if (_gotoType == null || !_gotoType.Visible) { Logger.Write("Creating typesearch form"); _gotoType = new TypeSearchForm( cache, (file, line, column) => { editor.GoTo(file, line, column); }, () => { new System.Threading.Thread(() => { System.Threading.Thread.Sleep(1000); editor.SetFocus(); }).Start(); }); _gotoType.Show(this); } setToForeground(_gotoType); } catch (Exception ex) { Logger.Write(ex); } }, null); }
private void userInput(MessageArgs message, Editor editor) { Logger.Write("Getting state for userinput fallback"); var state = new ConfigReader(_endpoint.Token).Get("oi.userinput.ui.fallback"); Logger.Write("State is "+state); if (state == "disabled") return; _ctx.Post((s) => { Logger.Write("Launching user input form"); try { var args = new CommandStringParser().Parse(message.Message).ToArray(); var defaultValue = ""; if (args.Length > 3) defaultValue = args[3]; var form = new UserInputForm(defaultValue, (item) => { if (item != null) _endpoint.PublishEvent("user-inputted '" + args[2] + "' '" + item + "'"); else _endpoint.PublishEvent("user-inputted '" + args[2] + "' 'user-cancelled'"); editor.SetFocus(); }); form.Show(this); setToForeground(form); } catch (Exception ex) { Logger.Write(ex); } }, null); }