/** @see javax.swing.Action#isEnabled() */
 public boolean isEnabled() {
   Object target = TargetManager.getInstance().getTarget();
   ArgoDiagram dia = ProjectManager.getManager().getCurrentProject().getActiveDiagram();
   if (dia == null) return false;
   MutableGraphModel gm = (MutableGraphModel) dia.getGraphModel();
   return gm.canAddNode(target);
 }
  /**
   * selects a diagram without affecting the gui.
   *
   * @param diagram the diagram
   */
  public void setCurrentDiagram(ArgoDiagram diagram) {

    if (diagram == null) {
      throw new RuntimeException("you can't select a null diagram");
    }

    currentGM = (ClassDiagramGraphModel) diagram.getGraphModel();
    currentLayer = diagram.getLayer();
    currentDiagram = diagram;

    markDiagramAsModified(diagram);
  }