use of jetbrains.communicator.core.users.User in project intellij-plugins by JetBrains.
the class UserTest method testSetGroupWithUserModel.
public void testSetGroupWithUserModel() throws Throwable {
assertEquals(UserModel.DEFAULT_GROUP, myUser.getGroup());
addEventListener();
myUser.setGroup("anotherGroup", myUserModel);
assertEquals("No events expected when user is not in model", 0, myEvents.size());
assertEquals("Group should be changed", "anotherGroup", myUser.getGroup());
myUserModel.addUser(myUser);
myEvents.clear();
User userCopy = UserImpl.create("someUser", MockTransport.NAME);
userCopy.setGroup("alexandria", myUserModel);
assertEquals("Group should be changed", "alexandria", userCopy.getGroup());
assertEquals("Group should be changed for user in Model", "alexandria", myUser.getGroup());
verifyUpdateEvent("group", "anotherGroup", "alexandria");
}
use of jetbrains.communicator.core.users.User 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.core.users.User in project intellij-plugins by JetBrains.
the class UserTreeTransferHandler method processUsersImport.
private void processUsersImport(JComponent comp, Transferable t) throws UnsupportedFlavorException, IOException {
final String targetGroup = getTargetGroup(comp);
final User[] movedUsers = (User[]) t.getTransferData(UsersTransferable.getMyDataFlavor());
for (User movedUser : movedUsers) {
movedUser.setGroup(targetGroup, myUserModel);
}
}
use of jetbrains.communicator.core.users.User in project intellij-plugins by JetBrains.
the class UserTree method onClick.
protected void onClick(TreePath path, Object pathComponent, MouseEvent e) {
super.onClick(path, pathComponent, e);
if (e.isShiftDown() || e.isControlDown() || e.isAltDown())
return;
myDelivered = false;
Object userObject = TreeUtils.getUserObject(pathComponent);
if (userObject instanceof User) {
User user = (User) userObject;
deliverLocalMessage(user, path, e);
}
}
use of jetbrains.communicator.core.users.User in project intellij-plugins by JetBrains.
the class JabberUserFinderImpl method findUsers.
@Override
public User[] findUsers(ProgressIndicator progressIndicator) {
final String currentProjectId = myIdeFacade.getCurrentProjectId();
List<User> users = new ArrayList<>();
if (currentProjectId != null) {
try {
progressIndicator.setText(StringUtil.getMsg("jabber.findUsers.text"));
URL url = new URL(myRegistryUrl + "?id=" + currentProjectId);
InputStream inputStream = url.openStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
String csv = reader.readLine();
inputStream.close();
if (csv != null) {
String[] strings = csv.split(",");
for (String userId : strings) {
if (!com.intellij.openapi.util.text.StringUtil.isEmptyOrSpaces(userId)) {
users.add(myUserModel.createUser(userId, JabberTransport.CODE));
}
}
}
} catch (MalformedURLException e) {
LOG.debug(e.getMessage(), e);
} catch (IOException e) {
LOG.debug(e.getMessage(), e);
}
}
return users.toArray(new User[users.size()]);
}
Aggregations