void Handle_serverIncomingMessage(object sender, MessageArgs e)
 {
     handle(e);
 }
 void handle(MessageArgs command)
 {
     Logger.Write("Handling incoming message: " + command.Message);
     _eventEndpoint.Send(command.Message);
     ThreadPool.QueueUserWorkItem((cmd) =>
         {
             _handlers
                 .ForEach(x => x(command, _cache, _editor));
         }, null);
 }
 void Handle_editorRecievedMessage(object sender, MessageArgs e)
 {
     handle(e.Message);
 }
Beispiel #4
0
 private void snippetCreate(MessageArgs message, Editor editor)
 {
     var command = "snippet-create ";
             var msg = message.Message
                 .Substring(command.Length, message.Message.Length - command.Length);
             new CreateSnippetHandler(editor, _cacheBuilder, Environment.CurrentDirectory)
                 .Handle(
                     new CommandStringParser()
                         .Parse(msg).ToArray());
 }
Beispiel #5
0
 private void handleMessage(MessageArgs message, ITypeCache cache, Editor editor)
 {
     if (message.Message == "gototype")
         goToType(cache, editor);
     if (message.Message == "explore")
         explore(cache, editor);
     if (message.Message.StartsWith("snippet-complete "))
         snippetComplete(message, editor);
     if (message.Message.StartsWith("snippet-create "))
         snippetCreate(message, editor);
     if (message.Message.StartsWith("member-lookup "))
         memberLookup(message, editor);
 }
Beispiel #6
0
 void handle(MessageArgs command)
 {
     _eventEndpoint.Send(command.Message);
     ThreadPool.QueueUserWorkItem((cmd) =>
         {
             _handlers
                 .ForEach(x => x(command, _cache, _editor));
         }, null);
 }
Beispiel #7
0
 private void memberLookup(MessageArgs message, Editor editor)
 {
     _ctx.Post((s) =>
         {
             var members = new string[]
                 {
                     "Text|Type: System.Int",
                     "Visible|Type: System.bool",
                     "BringToFront|Return Type: void",
                     "Parse(string[], bool)|Return Type: string[[newline]]\tstring[]: Line Array[[newline]]\tbool: Remove Empty entries"
                 };
             _memberLookup = new MemberLookupForm(members);
             _memberLookup.Show(this);
             setToForeground(_memberLookup);
         }, null);
 }
 private static void messageHandler(MessageArgs message, ITypeCache cache, Editor editor)
 {
     var msg = CommandMessage.New(message.Message);
     _handlers
         .Where(x => x.Handles(msg)).ToList()
         .ForEach(x => x.Handle(message.ClientID, msg));
 }
Beispiel #9
0
 void Handle_editorRecievedMessage(object sender, MessageArgs e)
 {
     var msg = CommandMessage.New(e.Message);
     var command = new CommandStringParser().GetArgumentString(msg.Arguments);
     var fullCommand = msg.Command + " " + command;
     handle(new MessageArgs(Guid.Empty, fullCommand.Trim()));
 }
Beispiel #10
0
 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);
 }
Beispiel #11
0
 void handle(MessageArgs command)
 {
 }
Beispiel #12
0
 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);
 }
Beispiel #13
0
 private void snippetComplete(MessageArgs message, Editor editor)
 {
     _ctx.Post((s) =>
         {
             var command = "snippet-complete ";
             var msg = message.Message.Substring(command.Length, message.Message.Length - command.Length);
             new CompleteSnippetHandler(_cacheBuilder, _endpoint.Token, _endpoint)
                 .Handle(
                     new CommandStringParser()
                         .Parse(msg).ToArray());
         }, null);
 }
Beispiel #14
0
 private void handleMessage(MessageArgs message, ITypeCache cache, Editor editor)
 {
     Logger.Write("Message trayform args: " + message.Message);
     if (message.Message == "gototype")
         goToType(cache, editor);
     if (message.Message == "explore")
         explore(cache, editor);
     if (message.Message.StartsWith("snippet-complete "))
         snippetComplete(message, editor);
     if (message.Message.StartsWith("snippet-create "))
         snippetCreate(message, editor);
     if (message.Message.StartsWith("member-lookup "))
         memberLookup(message, editor);
     if (message.Message.StartsWith("user-select \"unsupported\" "))
         userSelect(message, editor);
     if (message.Message.StartsWith("user-select-at-caret \"unsupported\" "))
         userSelect(message, editor);
     if (message.Message.StartsWith("user-input \"unsupported\" "))
         userInput(message, editor);
     if (message.Message == "shutdown")
         _terminateApplication = true;
 }
 void handle(MessageArgs command)
 {
     var message = _commandParser.GetArgumentString(_commandParser.Parse(command.Message).ToArray(), "'");
     Logger.Write("Event handle: " + message);
     _reactiveEngine.Handle(message);
 }
Beispiel #16
0
 void handle(MessageArgs command)
 {
     Logger.Write("Event handle: " + command.Message);
     _reactiveEngine.Handle(command.Message);
 }