Search in sources :

Example 1 with LocalMessage

use of jetbrains.communicator.core.dispatcher.LocalMessage in project intellij-plugins by JetBrains.

the class SearchHistoryCommand method execute.

public void execute() {
    String searchString = myIdeFacade.getMessage(StringUtil.getMsg("SearchHistoryCommand.enter.query.string"), StringUtil.getMsg("SearchHistoryCommand.search.history", myUser.getDisplayName()), StringUtil.getMsg("search"));
    if (searchString != null) {
        LocalMessage[] localMessages = myMessageDispatcher.getHistory(myUser, null);
        List<LocalMessage> result = new ArrayList<>();
        for (LocalMessage message : localMessages) {
            if (message.containsString(searchString)) {
                result.add(message);
            }
        }
        if (result.size() == 0) {
            myIdeFacade.showMessage(StringUtil.getMsg("SearchHistoryCommand.search.history", myUser.getDisplayName()), StringUtil.getMsg("SearchHistoryCommand.no.results"));
        } else {
            myIdeFacade.showSearchHistoryResults(result, myUser);
        }
    }
}
Also used : LocalMessage(jetbrains.communicator.core.dispatcher.LocalMessage) ArrayList(java.util.ArrayList)

Example 2 with LocalMessage

use of jetbrains.communicator.core.dispatcher.LocalMessage in project intellij-plugins by JetBrains.

the class DayHistory method resort.

public void resort() {
    for (User user : myData.keySet()) {
        List<LocalMessage> list = myData.get(user);
        Collections.sort(list, (o1, o2) -> o1.getWhen().compareTo(o2.getWhen()));
    }
}
Also used : LocalMessage(jetbrains.communicator.core.dispatcher.LocalMessage) User(jetbrains.communicator.core.users.User)

Example 3 with LocalMessage

use of jetbrains.communicator.core.dispatcher.LocalMessage in project intellij-plugins by JetBrains.

the class MessageHistory method filterHistoryByDate.

private List<LocalMessage> filterHistoryByDate(User user, Date since) {
    List<LocalMessage> list = myHistory.readMessages(user);
    if (since != null) {
        List<LocalMessage> result = new ArrayList<>(list.size());
        for (LocalMessage message : list) {
            if (message.getWhen().after(since)) {
                result.add(message);
            }
        }
        list = result;
    }
    return list;
}
Also used : LocalMessage(jetbrains.communicator.core.dispatcher.LocalMessage)

Example 4 with LocalMessage

use of jetbrains.communicator.core.dispatcher.LocalMessage in project intellij-plugins by JetBrains.

the class IDEAFacadeTest method testCreateLocalMessage_IncomingMessage.

public void testCreateLocalMessage_IncomingMessage() throws Exception {
    TransportEvent event = EventFactory.createMessageEvent(myTransport, "user", "comment123");
    Date when = new Date();
    event.setWhen(when.getTime());
    LocalMessage localMessage = myFacade.createLocalMessageForIncomingEvent(event);
    assertTrue("instance of Stacktracelocalmessage expected:" + localMessage.getClass().getName(), localMessage instanceof IncomingLocalMessage);
    assertEquals("comment123", ((BaseLocalMessage) localMessage).getComment());
    assertEquals(when, localMessage.getWhen());
}
Also used : TransportEvent(jetbrains.communicator.core.transport.TransportEvent) IncomingLocalMessage(jetbrains.communicator.idea.sendMessage.IncomingLocalMessage) LocalMessage(jetbrains.communicator.core.dispatcher.LocalMessage) IncomingLocalMessage(jetbrains.communicator.idea.sendMessage.IncomingLocalMessage) Date(java.util.Date)

Example 5 with LocalMessage

use of jetbrains.communicator.core.dispatcher.LocalMessage in project intellij-plugins by JetBrains.

the class IDEAFacadeTest method testCreateLocalMessage_Stacktrace.

public void testCreateLocalMessage_Stacktrace() throws Exception {
    TransportEvent event = EventFactory.createStacktraceEvent(myTransport, "user", "stacktrace", "comment123");
    LocalMessage localMessage = myFacade.createLocalMessageForIncomingEvent(event);
    assertTrue("instance of Stacktracelocalmessage expected", localMessage instanceof IncomingStacktraceMessage);
    assertEquals("comment123", ((BaseLocalMessage) localMessage).getComment());
}
Also used : TransportEvent(jetbrains.communicator.core.transport.TransportEvent) IncomingLocalMessage(jetbrains.communicator.idea.sendMessage.IncomingLocalMessage) LocalMessage(jetbrains.communicator.core.dispatcher.LocalMessage) IncomingStacktraceMessage(jetbrains.communicator.idea.sendMessage.IncomingStacktraceMessage)

Aggregations

LocalMessage (jetbrains.communicator.core.dispatcher.LocalMessage)20 IncomingLocalMessage (jetbrains.communicator.idea.sendMessage.IncomingLocalMessage)7 MockMessage (jetbrains.communicator.mock.MockMessage)7 Date (java.util.Date)6 TransportEvent (jetbrains.communicator.core.transport.TransportEvent)4 ArrayList (java.util.ArrayList)2 EventVisitor (jetbrains.communicator.core.EventVisitor)2 User (jetbrains.communicator.core.users.User)2 SendMessageEvent (jetbrains.communicator.ide.SendMessageEvent)2 BaseLocalMessage (jetbrains.communicator.idea.BaseLocalMessage)2 IncomingCodePointerMessage (jetbrains.communicator.idea.codePointer.IncomingCodePointerMessage)2 IncomingStacktraceMessage (jetbrains.communicator.idea.sendMessage.IncomingStacktraceMessage)2 MockTransport (jetbrains.communicator.mock.MockTransport)2 File (java.io.File)1 Message (jetbrains.communicator.core.dispatcher.Message)1 CodePointerEvent (jetbrains.communicator.core.transport.CodePointerEvent)1 MessageEvent (jetbrains.communicator.core.transport.MessageEvent)1 StacktraceEvent (jetbrains.communicator.core.transport.StacktraceEvent)1 CodePointer (jetbrains.communicator.core.vfs.CodePointer)1 SendCodePointerEvent (jetbrains.communicator.ide.SendCodePointerEvent)1