@Override
	public void mousePressed(MouseEvent e)  {
		boolean rightClicked = (e.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK;
		if(!rightClicked)
			return;
		tree.setSelectionPath(tree.getPathForLocation(e.getX(), e.getY()));
		        
		DialogNode node = getSelectedNode();
		if(node == null || editor.activeFile == null)
			return;

		add.setVisible(true);
		remove.setVisible(true);

		copy.setVisible(true);
		paste.setVisible(true);
		
		DialogNode copied = getClipboard();
		
		if(node.type == EnumNodeType.DIALOG){
			Dialog dialog = (Dialog) node.getUserObject();
			add.setVisible(dialog.getOptions().size() < 6);
			copy.setVisible(true);
			paste.setVisible(false);
		}
		else if(node.type == EnumNodeType.OPTION){
			add.setVisible(false);
			copy.setVisible(false);
			paste.setVisible(false);
		}
		else if(node.type == EnumNodeType.ROOT){
			remove.setVisible(false);
			copy.setVisible(false);
			paste.setEnabled(copied != null && copied.type == EnumNodeType.CATEGORY);
		}
		else if(node.type == EnumNodeType.CATEGORY){
			paste.setEnabled(copied != null && copied.type == EnumNodeType.DIALOG);
		}
		Point p = MouseInfo.getPointerInfo().getLocation();
		SwingUtilities.convertPointFromScreen(p, this);
		menu.show(this, p.x, p.y);
	}