Search in sources :

Example 1 with IdeaLocalMessage

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();
        }
    }
}
Also used : IdeaLocalMessage(jetbrains.communicator.idea.IdeaLocalMessage) Message(jetbrains.communicator.core.dispatcher.Message) IdeaLocalMessage(jetbrains.communicator.idea.IdeaLocalMessage)

Example 2 with IdeaLocalMessage

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);
}
Also used : IdeaLocalMessage(jetbrains.communicator.idea.IdeaLocalMessage) User(jetbrains.communicator.core.users.User) TreePath(javax.swing.tree.TreePath) Message(jetbrains.communicator.core.dispatcher.Message) IdeaLocalMessage(jetbrains.communicator.idea.IdeaLocalMessage)

Example 3 with IdeaLocalMessage

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);
    });
}
Also used : IdeaLocalMessage(jetbrains.communicator.idea.IdeaLocalMessage) IDEFacade(jetbrains.communicator.ide.IDEFacade)

Aggregations

IdeaLocalMessage (jetbrains.communicator.idea.IdeaLocalMessage)3 Message (jetbrains.communicator.core.dispatcher.Message)2 TreePath (javax.swing.tree.TreePath)1 User (jetbrains.communicator.core.users.User)1 IDEFacade (jetbrains.communicator.ide.IDEFacade)1