Example #1
0
 void Handle_serverIncomingMessage(object sender, MessageArgs e)
 {
     var command = new CommandMessage(e.ClientID, e.Message.Trim());
     _dispatcher.Publish(command);
     if (!e.Message.Trim().StartsWith("correlationID="))
         _server.Send(e.Message); // Pass on to all consuming clients
 }
 public EditorCaretMessage(CommandMessage message, Caret caret)
 {
     Message = message;
     File = caret.File;
     Position = caret.Position;
     Content = caret.Content;
 }
 public void Execute(CommandMessage msg)
 {
     var argument = msg.Arguments.ToArray();
     var message = EditorReplaceMessage.Parse(argument);
     if (message == null)
         return;
     _dispatcher.Publish(message);
 }
 public void Execute(CommandMessage message)
 {
     Logger.Write("Hanlind use request message with " + message.Arguments.Count.ToString() + " arguments");
     var arguments = message.Arguments;
     if (arguments.Count < 2)
         return;
     _dispatcher.Publish(new EditorRequestUserSelectionAtCaret(arguments[0], arguments[1]));
 }
 public void Execute(CommandMessage message)
 {
     Logger.Write("Hanlind use request message with " + message.Arguments.Count.ToString() + " arguments");
     var arguments = message.Arguments;
     var defaultvalue = "";
     if (arguments.Count > 1)
         defaultvalue = arguments[1];
     _dispatcher.Publish(new EditorRequestUserInput(arguments[0], defaultvalue));
 }
 public void Should_not_initialize_editor_if_plugin_does_not_load()
 {
     _editor.Stub(x => x.IsAlive).Return(true);
     var message = new CommandMessage(Guid.NewGuid(), "correlationID=meh|gedit");
     _dispatcher.Consume(
         new EditorLoadMessage(
             message, "gedit"));
     _editor.AssertWasNotCalled(x => x.Initialize(null), y => y.IgnoreArguments());
 }
 public void Execute(CommandMessage message)
 {
     Logger.Write("Hanlind use request message with " + message.Arguments.Count.ToString() + " arguments");
     var arguments = message.Arguments;
     if (arguments.Count < 2)
         return;
     var defaultValue = "";
     if (arguments.Count == 3)
         defaultValue = arguments[2];
     _dispatcher.Publish(new EditorRequestUserSelection(arguments[0], arguments[1], defaultValue));
 }
 public void Should_initialize_editor_if_plugin_loads()
 {
     _editor.Stub(x => x.IsAlive).Return(true);
     _pluginFactory.Stub(x => x.Load("gedit")).Return(_editor);
     var message = new CommandMessage(Guid.NewGuid(), "correlationID=meh|gedit");
     _dispatcher.Consume(
         new EditorLoadMessage(
             message, "gedit"));
     _editor.AssertWasCalled(x => x.Initialize(null), y => y.IgnoreArguments());
     _messageDispatcher.Published<EditorLoadedMessage>();
 }
 public void Execute(CommandMessage message)
 {
     var argument = message.Arguments;
     if (argument.Count != 1)
         return;
     if (!File.Exists(argument[0]))
         return;
     _dispatcher.Publish(
         new EditorRefactorMessage(
             File.ReadAllLines(argument[0])));
 }
Example #10
0
 public void Execute(CommandMessage message)
 {
     var arguments = message.Arguments;
     if (arguments.Count != 1)
     {
         invalidArgs();
         return;
     }
     var location = getLocation(arguments[0]);
     if (location == null)
         return;
     _dispatcher.Publish(new EditorGoToMessage(location.File, location.Line, location.Column));
 }
 public void When_process_id_is_not_running_a_shutdown_message_should_be_published()
 {
     _editor.Stub(x => x.IsAlive).Return(false);
     _pluginFactory.Stub(x => x.Load("gedit")).Return(_editor);
     var message = new CommandMessage(Guid.NewGuid(), "correlationID=meh|gedit");
     _dispatcher.Consume(
         new EditorLoadMessage(
             message, "gedit"));
     Wait.ForFiveSecond().OrUntil(() => { return _messageDispatcher.GetPublishedMessage<ShutdownMessage>() != null; });
     _messageDispatcher.Published<ShutdownMessage>();
 }
 public EditorWindowListMessage(CommandMessage message, string[] windows)
 {
     Message = message;
     Windows = windows;
 }
 public EditorDirtyFilesListMessage(CommandMessage message, KeyValuePair<string,string>[] files)
 {
     Message = message;
     DirtyFiles = files;
 }
 public EditorGetCaretMessage(CommandMessage message)
 {
     Message = message;
 }
 public void Execute(CommandMessage message)
 {
     _dispatcher.Publish(new EditorSetFocusMessage());
 }
 public void Execute(CommandMessage message)
 {
     _dispatcher.Publish(
         new EditorCommandMessage(
             message.Arguments.ToArray()));
 }
 public EditorGetWindowsMessage(CommandMessage message)
 {
     Message = message;
 }
 public EditorLoadedMessage(CommandMessage message, string editor)
 {
     Message = message;
     Editor = editor;
 }