public JPopupMenu buildPopupMenu(final OdorWorldEntity theEntity){
  final JPopupMenu ret=new JPopupMenu();
  if (theEntity == null) {
    ret.add(new JMenuItem(new AddEntityAction(this)));
    ret.add(new JMenuItem(new AddAgentAction(this)));
    ret.addSeparator();
    ret.add(new JMenuItem(new ShowWorldPrefsAction(this)));
    return ret;
  }
  ret.add(new JMenuItem(new ShowEntityDialogAction(theEntity)));
  if (theEntity.getSmellSource() == null) {
    ret.addSeparator();
    ret.add(new JMenuItem(new AddSmellSourceAction(this,theEntity)));
  }
  ret.addSeparator();
  ret.add(new JMenuItem(new DeleteEntityAction(this,theEntity)));
  return ret;
}

public JPopupMenu buildPopupMenu ( final OdorWorldEntity theEntity ) { final JPopupMenu ret = new JPopupMenu ( ) ; if ( theEntity == null ) { ret . add ( new JMenuItem ( new AddEntityAction ( this ) ) ) ; ret . add ( new JMenuItem ( new AddAgentAction ( this ) ) ) ; ret . addSeparator ( ) ; ret . add ( new JMenuItem ( new ShowWorldPrefsAction ( this ) ) ) ; return ret ; } ret . add ( new JMenuItem ( new ShowEntityDialogAction ( theEntity ) ) ) ; if ( theEntity . getSmellSource ( ) == null ) { ret . addSeparator ( ) ; ret . add ( new JMenuItem ( new AddSmellSourceAction ( this , theEntity ) ) ) ; } ret . addSeparator ( ) ; ret . add ( new JMenuItem ( new DeleteEntityAction ( this , theEntity ) ) ) ; return ret ; }
create a popup menu based on location of mouse click .
