Search in sources :

Example 56 with User

use of jetbrains.communicator.core.users.User in project intellij-plugins by JetBrains.

the class SelectionProcessor method getSelectedUsers.

public Set<User> getSelectedUsers() {
    TreePath[] selectionPaths = myUserTree.getSelectionPaths();
    if (selectionPaths == null)
        selectionPaths = new TreePath[0];
    Set<User> result = new HashSet<>();
    for (TreePath selectionPath : selectionPaths) {
        Object userObject = TreeUtils.getUserObject(selectionPath);
        if (userObject instanceof User) {
            result.add((User) userObject);
        } else {
            // group
            TreeNode treeNode = ((TreeNode) selectionPath.getLastPathComponent());
            Enumeration enumeration = treeNode.children();
            while (enumeration.hasMoreElements()) {
                TreeNode node = (TreeNode) enumeration.nextElement();
                result.add((User) ((DefaultMutableTreeNode) node).getUserObject());
            }
        }
    }
    return result;
}
Also used : User(jetbrains.communicator.core.users.User) TreePath(javax.swing.tree.TreePath) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) TreeNode(javax.swing.tree.TreeNode) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode)

Example 57 with User

use of jetbrains.communicator.core.users.User in project intellij-plugins by JetBrains.

the class ViewFilesCommand method execute.

public void execute() {
    User user = myUserListComponent.getSelectedUser();
    assert user != null;
    ProjectsData projectsData = user.getProjectsData(myFacade);
    if (projectsData.isEmpty()) {
        myFacade.showMessage(StringUtil.getMsg("ViewFilesCommand.no.information"), StringUtil.getMsg("ViewFilesCommand.no.information.for.user", user.getDisplayName()));
    } else {
        myFacade.showUserFiles(user, projectsData);
    }
}
Also used : User(jetbrains.communicator.core.users.User) ProjectsData(jetbrains.communicator.core.vfs.ProjectsData)

Example 58 with User

use of jetbrains.communicator.core.users.User in project intellij-plugins by JetBrains.

the class MessagesTabTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    myUserMock = mock(User.class);
    myUser = (User) myUserMock.proxy();
    final Mock consoleStub = mock(ConsoleView.class);
    consoleStub.stubs().method(ANYTHING);
    consoleStub.stubs().method("getComponent").will(returnValue(new JLabel()));
    LocalMessageDispatcherImpl localMessageDispatcher = new LocalMessageDispatcherImpl(getBroadcaster(), new MockIDEFacade(getClass()), null);
    disposeOnTearDown(localMessageDispatcher);
    myMessagesTab = new MessagesTab(null, myUser, localMessageDispatcher, true) {

        @Override
        protected ConsoleView createConsoleView(Project project) {
            return (ConsoleView) consoleStub.proxy();
        }
    };
    disposeOnTearDown(myMessagesTab);
}
Also used : Project(com.intellij.openapi.project.Project) User(jetbrains.communicator.core.users.User) ConsoleView(com.intellij.execution.ui.ConsoleView) MockIDEFacade(jetbrains.communicator.mock.MockIDEFacade) LocalMessageDispatcherImpl(jetbrains.communicator.core.impl.dispatcher.LocalMessageDispatcherImpl) Mock(org.jmock.Mock)

Example 59 with User

use of jetbrains.communicator.core.users.User in project intellij-plugins by JetBrains.

the class JabberTransport_ConnectionTest method testAddUser_NotIdeTalk.

public void testAddUser_NotIdeTalk() throws Throwable {
    addEventListener();
    addUserFred();
    IDEtalkEvent event = checkEvent(false);
    assertTrue(event.toString(), event instanceof UserEvent.Added);
    User user = ((UserEvent.Added) event).getUser();
    assertEquals("Jabber user expected", "Jabber", user.getTransportCode());
    assertEquals("Should add Jabber user", FRED, user.getName());
    assertEquals("Wrong group", "aGroup", user.getGroup());
    assertFalse(user.hasIDEtalkClient());
}
Also used : User(jetbrains.communicator.core.users.User) IDEtalkEvent(jetbrains.communicator.core.IDEtalkEvent) UserEvent(jetbrains.communicator.core.users.UserEvent)

Example 60 with User

use of jetbrains.communicator.core.users.User in project intellij-plugins by JetBrains.

the class JabberTransport_ConnectionTest method testAddUser_IdeTalk.

public void testAddUser_IdeTalk() throws Throwable {
    XMPPConnection conn = createLocalConnectionWithJabberUser("fred" + System.nanoTime(), JabberFacadeImpl.IDETALK_RESOURCE);
    addEventListener();
    final String fred = getUser(conn);
    addUser(fred);
    IDEtalkEvent event = checkEvent(false);
    assertTrue(event.toString(), event instanceof UserEvent.Added);
    User user = ((UserEvent.Added) event).getUser();
    assertEquals("Jabber user expected", "Jabber", user.getTransportCode());
    assertEquals("Should add Jabber user", fred, user.getName());
    assertEquals("Wrong group", "aGroup", user.getGroup());
    new WaitFor(TIMEOUT) {

        @Override
        protected boolean condition() {
            return myFacade.getConnection().getRoster().getPresence(fred) != null;
        }
    };
    assertTrue("User with IDEtalk resource", user.hasIDEtalkClient());
}
Also used : User(jetbrains.communicator.core.users.User) WaitFor(jetbrains.communicator.util.WaitFor) IDEtalkEvent(jetbrains.communicator.core.IDEtalkEvent) UserEvent(jetbrains.communicator.core.users.UserEvent)

Aggregations

User (jetbrains.communicator.core.users.User)64 MockUser (jetbrains.communicator.mock.MockUser)25 UserPresence (jetbrains.communicator.core.users.UserPresence)6 ArrayList (java.util.ArrayList)5 UserEvent (jetbrains.communicator.core.users.UserEvent)5 TreeNode (javax.swing.tree.TreeNode)4 BaseUserImpl (jetbrains.communicator.core.impl.users.BaseUserImpl)4 MockTransport (jetbrains.communicator.mock.MockTransport)4 WaitFor (jetbrains.communicator.util.WaitFor)4 Project (com.intellij.openapi.project.Project)3 TreePath (javax.swing.tree.TreePath)3 IOException (java.io.IOException)2 URL (java.net.URL)2 List (java.util.List)2 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)2 IDEtalkEvent (jetbrains.communicator.core.IDEtalkEvent)2 LocalMessage (jetbrains.communicator.core.dispatcher.LocalMessage)2 Message (jetbrains.communicator.core.dispatcher.Message)2 Transport (jetbrains.communicator.core.transport.Transport)2 ProjectsData (jetbrains.communicator.core.vfs.ProjectsData)2