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);
}
}
}
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()));
}
}
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;
}
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());
}
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());
}
Aggregations