powered by Jive Software

Add Contact Group menu item is missing on Contacts menu


#1

I have installed spark 2.7.6 and open fire 4.1 and integrated open fire with custom db.

I am creating spark custom plugin to customize some of the features.

I found an issue on Spark UI.

The “Add Contact Group” menu item is getting disappeared automatically some times on Spark UI.

Below are the steps to reproduce it.

  1. Log in to Spark UI.

  2. Spark UI is displayed with JMenu bar, Contact List contains Contact Group and Contact Items.

  3. Click on Contacts menu, I can see “Add Contact Group” options in Contacts menu.

  4. Right click on any Contact Group displayed on Contact List screen

  5. A Popup opens and by selecting “Add contact Group” option, create a new contact group.

  6. New Contact Group is also displayed on Contact List Screen

  7. Now if go to Contacts menu, “Add Contact Group” option is getting disappeared.

8)** Log out and Log in back, and click on Contacts menu, Add Contact group is displayed as normal.**

I have not seen any exception, I also have run it on Eclipse debug mode and did not see any error

Is it the default behavior or did I make any thing wrong?

Thanks, Venu


#2

The same is also happening even when I Add new Contact by right clicking on any Contact Group in Contact List.


#3

This is a known long standing bug [SPARK-953] Add Contact Group menu item disappears after right-clicking a Contact Group header - IgniteRealtime JIRA


#4

Hi Wroot,

When can we expect the fix for this issue?

Thanks, Venu


#5

Spark project doesn’t have full-time qualified developers working on it. Only a few volunteers without java skills and occasionally someone providing patches. So the answer might be as soon as someone provides a patch (could be never in the worse scenario).


#6

A way around it is to implement a plugin. You store an instance of the “Add Contacts Menu” object when the plugin initializes. You also add a mouse listener on the Contacts menu that checks if the “Add Contacts Menu” is there, and if it’s not you add the reference to it.
This is just a band ait solution since I haven’t been able to determine where exactly the menu gets removed.
Code below (add missing imports as necessary for your own plugin):

public class Changes implements Plugin {

private JMenuItem addContactGroupMenu = null;

/**
 * Called after Spark is loaded to initialize the new plugin.
 */
public void initialize() {
    
    storeAddContactMenuReference();
       
    //Add a mouse listener to contact list to determine what happens to the menu 
    addContactLIstMouseListener();
}


private void addContactLIstMouseListener() {
	// TODO Auto-generated method stub
	final JMenu contactsMenu = SparkManager.getMainWindow().getMenuByName(Res.getString("menuitem.contacts"));
	
	contactsMenu.addMouseListener(new MouseListener() {
		
		@Override
		public void mouseReleased(MouseEvent e) {
			// TODO Auto-generated method stub
			
		}
		
		@Override
		public void mousePressed(MouseEvent e) {
			
		}
		
		@Override
		public void mouseExited(MouseEvent e) {
			// TODO Auto-generated method stub
			
		}
		
		@Override
		public void mouseEntered(MouseEvent e) {
			System.out.println("Mouse was pressed");
			boolean contactGroupExists = false;
			for(int i=0; i<contactsMenu.getItemCount(); i++)
	    	{
				JMenuItem currentItem = contactsMenu.getItem(i);	
				
				if(currentItem.getText().equalsIgnoreCase(Res.getString("menuitem.add.contact.group"))) {
						contactGroupExists = true;
				}
			}
			if(!contactGroupExists) {
				if(addContactGroupMenu != null) {
					if(!Default.getBoolean("ADD_CONTACT_GROUP_DISABLED")){   
					       contactsMenu.add(addContactGroupMenu, 1);
				    }
				}
			}
			
		}
		
		@Override
		public void mouseClicked(MouseEvent e) {
			
		}
	});
}

private void storeAddContactMenuReference() {
	JMenu contactsMenu = SparkManager.getMainWindow().getMenuByName(Res.getString("menuitem.contacts"));
	for(int i=0; i<contactsMenu.getItemCount(); i++)
	{
		JMenuItem currentItem = contactsMenu.getItem(i);	
		
		if(currentItem.getText().equalsIgnoreCase(Res.getString("menuitem.add.contact.group"))) 
			{
				addContactGroupMenu = new JMenuItem();
				addContactGroupMenu = currentItem;
			}
	}
}

}