use of jetbrains.communicator.idea.IdeaLocalMessage in project intellij-plugins by JetBrains.
the class UserTree method deliverLocalMessage.
private void deliverLocalMessage(User user, TreePath path, MouseEvent e) {
Message[] pendingMessages = myLocalMessageDispatcher.getPendingMessages(user);
if (pendingMessages.length > 0) {
IdeaLocalMessage message = (IdeaLocalMessage) pendingMessages[0];
if (myLocalMessageDispatcher.sendNow(user, message)) {
myDelivered = true;
e.consume();
((MyTreeUI) getUI()).invalidatePath(path);
treeDidChange();
}
}
}
use of jetbrains.communicator.idea.IdeaLocalMessage in project intellij-plugins by JetBrains.
the class UserTree method getToolTipText.
public String getToolTipText(MouseEvent e) {
TreePath pathForLocation = getPathForLocation(e.getX(), e.getY());
if (pathForLocation != null) {
Object userObject = TreeUtils.getUserObject(pathForLocation);
if (userObject instanceof User) {
User user = (User) userObject;
StringBuffer result = new StringBuffer();
if (!user.getName().equals(user.getDisplayName())) {
result.append(StringUtil.getMsg("user.tooltip", user.getName())).append("\n");
}
Message[] pendingMessages = myLocalMessageDispatcher.getPendingMessages(user);
if (pendingMessages.length > 0) {
IdeaLocalMessage ideaLocalMessage = (IdeaLocalMessage) pendingMessages[0];
result.append(ideaLocalMessage.getTitle());
if (result.length() > 0 && ideaLocalMessage.getComment().length() > 0) {
result.append(": ");
}
result.append(ideaLocalMessage.getComment());
}
return result.length() == 0 ? super.getToolTipText(e) : result.toString();
}
}
return super.getToolTipText(e);
}
use of jetbrains.communicator.idea.IdeaLocalMessage in project intellij-plugins by JetBrains.
the class EventsProcessor method showPopupNotification.
private void showPopupNotification(final User from, TransportEvent event) {
if (myMessageDispatcher.countPendingMessages() > 5)
return;
IDEFacade ideFacade = ((IDEFacade) Pico.getInstance().getComponentInstanceOfType(IDEFacade.class));
final IdeaLocalMessage localMessage = (IdeaLocalMessage) ideFacade.createLocalMessageForIncomingEvent(event);
if (localMessage == null)
return;
UIUtil.invokeLater(() -> {
JComponent content = localMessage.getPopupComponent(from, myProject);
Color backgroundColor = new Color(255, 255, 217);
content.setOpaque(true);
content.setBackground(backgroundColor);
WindowManager.getInstance().getStatusBar(myProject).fireNotificationPopup(content, backgroundColor);
});
}
Aggregations