Search in sources :

Example 1 with UserModel

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

the class BaseEditorPopup method getChildren.

@NotNull
public AnAction[] getChildren(AnActionEvent e) {
    if (e == null)
        return EMPTY_ARRAY;
    final Editor editor = getEditor(e);
    final VirtualFile file = getFile(e);
    if (file == null || editor == null)
        return EMPTY_ARRAY;
    List<AnAction> result = new ArrayList<>();
    final UserModel userModel = getUserModel();
    String[] groups = userModel.getGroups();
    List<String> groupsWithUsers = new ArrayList<>();
    for (String group : groups) {
        if (userModel.getUsers(group).length > 0) {
            groupsWithUsers.add(group);
        }
    }
    if (groupsWithUsers.size() == 1) {
        User[] users = userModel.getUsers(groupsWithUsers.get(0));
        fillWithUserActions(users, result, file, editor);
    } else {
        for (String groupsWithUser : groupsWithUsers) {
            ActionGroup actionGroup = createGroupWithUsersActionGroup(groupsWithUser, userModel, file, editor);
            result.add(actionGroup);
        }
    }
    return result.toArray(new AnAction[result.size()]);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) UserModel(jetbrains.communicator.core.users.UserModel) User(jetbrains.communicator.core.users.User) ActionGroup(com.intellij.openapi.actionSystem.ActionGroup) ArrayList(java.util.ArrayList) Editor(com.intellij.openapi.editor.Editor) AnAction(com.intellij.openapi.actionSystem.AnAction) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with UserModel

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

the class IDEtalkMessagesWindowImpl method projectOpened.

@Override
public void projectOpened() {
    super.projectOpened();
    installIconBlinker(myToolWindow);
    Pico pico = Pico.getInstance();
    myEventsProcessor = new EventsProcessor(this, (UserModel) pico.getComponentInstanceOfType(UserModel.class), getLocalDispatcher(), myProject);
    myToolWindow.installWatcher(myContentManager);
}
Also used : Pico(jetbrains.communicator.core.Pico) UserModel(jetbrains.communicator.core.users.UserModel)

Example 3 with UserModel

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

the class FindUsersCommandTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    myUserModelMock = mock(UserModel.class);
    myTransportMock = mock(Transport.class);
    myTransportMock1 = mock(Transport.class);
    myIDEFacade = new MockIDEFacade();
    myUserModelMock.stubs().method("getBroadcaster").will(returnValue(getBroadcaster()));
    myCommand = new FindUsersCommand((UserModel) myUserModelMock.proxy(), new Transport[] { (Transport) myTransportMock.proxy(), (Transport) myTransportMock1.proxy() }, myIDEFacade);
    assertTrue(myCommand.isEnabled());
    assertNotNull(myCommand.getName());
}
Also used : UserModel(jetbrains.communicator.core.users.UserModel) MockIDEFacade(jetbrains.communicator.mock.MockIDEFacade) Transport(jetbrains.communicator.core.transport.Transport)

Aggregations

UserModel (jetbrains.communicator.core.users.UserModel)3 ActionGroup (com.intellij.openapi.actionSystem.ActionGroup)1 AnAction (com.intellij.openapi.actionSystem.AnAction)1 Editor (com.intellij.openapi.editor.Editor)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 ArrayList (java.util.ArrayList)1 Pico (jetbrains.communicator.core.Pico)1 Transport (jetbrains.communicator.core.transport.Transport)1 User (jetbrains.communicator.core.users.User)1 MockIDEFacade (jetbrains.communicator.mock.MockIDEFacade)1 NotNull (org.jetbrains.annotations.NotNull)1