public void addPopUp(ActionListener listener)
	{
		//Define the popup
        popup = new JPopupMenu();
       
        menuItem = new JMenuItem("Insert animation");
        menuItem.addActionListener(listener);
        menuItem.setActionCommand("insert animation");
        popup.add(menuItem);
        
        menuItem = new JMenuItem("Insert pose");
        menuItem.addActionListener(listener);
        menuItem.setActionCommand("insert pose");
        popup.add(menuItem);
        
        menuItem = new JMenuItem("Remove");
        menuItem.addActionListener(listener);
        menuItem.setActionCommand("remove");
        popup.add(menuItem);
        
        popup.setOpaque(true);
        popup.setLightWeightPopupEnabled(true);
        
        //Define the rootPopup
        rootPopup = new JPopupMenu();
        menuItem = new JMenuItem("Insert animation");
        menuItem.addActionListener(listener);
        menuItem.setActionCommand("insert animation");
        rootPopup.add(menuItem);
        
        menuItem = new JMenuItem("Insert pose");
        menuItem.addActionListener(listener);
        menuItem.setActionCommand("insert pose");
        rootPopup.add(menuItem);
        
        rootPopup.setOpaque(true);
        rootPopup.setLightWeightPopupEnabled(true);
        
        //Define the leafPopup
        leafPopup = new JPopupMenu();
        
        menuItem = new JMenuItem("Remove");
        menuItem.addActionListener(listener);
        menuItem.setActionCommand("remove");
        leafPopup.add(menuItem);
        
        leafPopup.setOpaque(true);
        leafPopup.setLightWeightPopupEnabled(true);
        
        
        
        tree.addMouseListener
        (
        		new MouseAdapter()
        		{
        			public void mouseReleased( MouseEvent e )
        			{
        				if ( e.isPopupTrigger())
        				{
        					int row = tree.getClosestRowForLocation(e.getX(), e.getY());  
        					tree.setSelectionRow(row);
        					if(getSelectedNode().isRoot())
        						rootPopup.show((JComponent)e.getSource(), e.getX(), e.getY() );
        					if(getSelectedNode().isLeaf())
        						leafPopup.show((JComponent)e.getSource(), e.getX(), e.getY() );
        					if(!getSelectedNode().isLeaf() && !getSelectedNode().isRoot())
        						popup.show( (JComponent)e.getSource(), e.getX(), e.getY() );
        					
        				}  
        			}

        		}
        );
	}