|
|
|
|
@ -1189,45 +1189,46 @@ else if (deviceNumber > 1)
|
|
|
|
|
*/
|
|
|
|
|
private void addContact(SourceUIContact contact)
|
|
|
|
|
{
|
|
|
|
|
JMenuItem addContactMenu = TreeContactList.createAddContactMenu(
|
|
|
|
|
(SourceContact) contact.getDescriptor());
|
|
|
|
|
SourceContact sourceContact = (SourceContact) contact.getDescriptor();
|
|
|
|
|
|
|
|
|
|
JPopupMenu popupMenu;
|
|
|
|
|
List<ContactDetail> details = sourceContact.getContactDetails();
|
|
|
|
|
int detailsCount = details.size();
|
|
|
|
|
|
|
|
|
|
if (addContactMenu instanceof JMenu)
|
|
|
|
|
if (detailsCount > 1)
|
|
|
|
|
{
|
|
|
|
|
JMenu menu = ((JMenu) addContactMenu);
|
|
|
|
|
popupMenu = menu.getPopupMenu();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
popupMenu = new JPopupMenu();
|
|
|
|
|
popupMenu.add(addContactMenu);
|
|
|
|
|
}
|
|
|
|
|
JMenuItem addContactMenu = TreeContactList.createAddContactMenu(
|
|
|
|
|
(SourceContact) contact.getDescriptor());
|
|
|
|
|
|
|
|
|
|
// Add a title label.
|
|
|
|
|
JLabel infoLabel = new JLabel();
|
|
|
|
|
infoLabel.setText("<html><b>"
|
|
|
|
|
+ GuiActivator.getResources()
|
|
|
|
|
.getI18NString("service.gui.ADD_CONTACT")
|
|
|
|
|
+ "</b></html>");
|
|
|
|
|
JPopupMenu popupMenu = ((JMenu) addContactMenu).getPopupMenu();
|
|
|
|
|
|
|
|
|
|
popupMenu.insert(infoLabel, 0);
|
|
|
|
|
popupMenu.insert(new Separator(), 1);
|
|
|
|
|
// Add a title label.
|
|
|
|
|
JLabel infoLabel = new JLabel();
|
|
|
|
|
infoLabel.setText("<html><b>"
|
|
|
|
|
+ GuiActivator.getResources()
|
|
|
|
|
.getI18NString("service.gui.ADD_CONTACT")
|
|
|
|
|
+ "</b></html>");
|
|
|
|
|
|
|
|
|
|
popupMenu.setFocusable(true);
|
|
|
|
|
popupMenu.setInvoker(tree);
|
|
|
|
|
popupMenu.insert(infoLabel, 0);
|
|
|
|
|
popupMenu.insert(new Separator(), 1);
|
|
|
|
|
|
|
|
|
|
Point location = new Point(addContactButton.getX(),
|
|
|
|
|
addContactButton.getY() + addContactButton.getHeight());
|
|
|
|
|
popupMenu.setFocusable(true);
|
|
|
|
|
popupMenu.setInvoker(tree);
|
|
|
|
|
|
|
|
|
|
SwingUtilities.convertPointToScreen(location, tree);
|
|
|
|
|
Point location = new Point(addContactButton.getX(),
|
|
|
|
|
addContactButton.getY() + addContactButton.getHeight());
|
|
|
|
|
|
|
|
|
|
location.y = location.y
|
|
|
|
|
+ tree.getPathBounds(tree.getSelectionPath()).y;
|
|
|
|
|
SwingUtilities.convertPointToScreen(location, tree);
|
|
|
|
|
|
|
|
|
|
popupMenu.setLocation(location.x + 8, location.y - 8);
|
|
|
|
|
popupMenu.setVisible(true);
|
|
|
|
|
location.y = location.y
|
|
|
|
|
+ tree.getPathBounds(tree.getSelectionPath()).y;
|
|
|
|
|
|
|
|
|
|
popupMenu.setLocation(location.x + 8, location.y - 8);
|
|
|
|
|
popupMenu.setVisible(true);
|
|
|
|
|
}
|
|
|
|
|
else if (details.size() == 1)
|
|
|
|
|
{
|
|
|
|
|
TreeContactList.showAddContactDialog(details.get(0));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|