Search in sources :

Example 1 with UserListComponent

use of jetbrains.communicator.ide.UserListComponent in project intellij-plugins by JetBrains.

the class ToggleFileAccessCommandTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    myUserListComponent = mock(UserListComponent.class);
    myUserModel = new UserModelImpl(getBroadcaster());
    disposeOnTearDown(myUserModel);
    myCommand = new ToggleFileAccessCommand(myUserModel, (UserListComponent) myUserListComponent.proxy()) {

        @Override
        protected boolean isFocused() {
            return true;
        }
    };
}
Also used : UserModelImpl(jetbrains.communicator.core.impl.users.UserModelImpl) UserListComponent(jetbrains.communicator.ide.UserListComponent)

Example 2 with UserListComponent

use of jetbrains.communicator.ide.UserListComponent in project intellij-plugins by JetBrains.

the class SearchHistoryAction method update.

public void update(AnActionEvent e) {
    super.update(e);
    Project project = getProject(e);
    MutablePicoContainer container = getContainer(project);
    SearchHistoryCommand command = getCommand(e);
    User selectedUser;
    if (container != null && project != null && command != null) {
        boolean focused = false;
        if (IDEtalkMessagesWindowImpl.PLACE_TOOLBAR.equals(e.getPlace())) {
            IDEtalkMessagesWindow messagesWindow = project.getComponent(IDEtalkMessagesWindow.class);
            selectedUser = messagesWindow.getSelectedUser();
            focused = messagesWindow.hasFocus();
        } else {
            UserListComponent userList = (UserListComponent) container.getComponentInstanceOfType(UserListComponent.class);
            selectedUser = userList.getSelectedUser();
            focused = userList.getComponent().hasFocus();
        }
        command.setUser(selectedUser);
        e.getPresentation().setEnabled(command.isEnabled() && focused);
    }
}
Also used : Project(com.intellij.openapi.project.Project) MutablePicoContainer(org.picocontainer.MutablePicoContainer) User(jetbrains.communicator.core.users.User) SearchHistoryCommand(jetbrains.communicator.commands.SearchHistoryCommand) IDEtalkMessagesWindow(jetbrains.communicator.idea.IDEtalkMessagesWindow) UserListComponent(jetbrains.communicator.ide.UserListComponent)

Example 3 with UserListComponent

use of jetbrains.communicator.ide.UserListComponent in project intellij-plugins by JetBrains.

the class BaseEditorAction method setUser.

private void setUser(MutablePicoContainer container, T command) {
    UserListComponent userList = (UserListComponent) container.getComponentInstanceOfType(UserListComponent.class);
    command.setUser(userList.getSelectedUser());
}
Also used : UserListComponent(jetbrains.communicator.ide.UserListComponent)

Example 4 with UserListComponent

use of jetbrains.communicator.ide.UserListComponent in project intellij-plugins by JetBrains.

the class DeleteCommandTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    myUserListComponentMock = mock(UserListComponent.class);
    myIDEFacade = mock(IDEFacade.class);
    myUserModel = new UserModelImpl(getBroadcaster());
    disposeOnTearDown(myUserModel);
    myCommand = new DeleteCommand(myUserModel, (UserListComponent) myUserListComponentMock.proxy(), (IDEFacade) myIDEFacade.proxy()) {

        @Override
        protected boolean isFocused() {
            return true;
        }
    };
}
Also used : UserModelImpl(jetbrains.communicator.core.impl.users.UserModelImpl) UserListComponent(jetbrains.communicator.ide.UserListComponent) IDEFacade(jetbrains.communicator.ide.IDEFacade)

Aggregations

UserListComponent (jetbrains.communicator.ide.UserListComponent)4 UserModelImpl (jetbrains.communicator.core.impl.users.UserModelImpl)2 Project (com.intellij.openapi.project.Project)1 SearchHistoryCommand (jetbrains.communicator.commands.SearchHistoryCommand)1 User (jetbrains.communicator.core.users.User)1 IDEFacade (jetbrains.communicator.ide.IDEFacade)1 IDEtalkMessagesWindow (jetbrains.communicator.idea.IDEtalkMessagesWindow)1 MutablePicoContainer (org.picocontainer.MutablePicoContainer)1