/*
   * @see java.awt.event.ActionListener#actionPerformed(
   *      java.awt.event.ActionEvent)
   */
  @Override
  public void actionPerformed(ActionEvent e) {

    // TODO: Get Project or other necessary context from source??
    // e.getSource();

    // TODO: Since there may be multiple top level elements in
    // a project, this should be using the default Namespace (currently
    // undefined) or something similar
    Project p = ProjectManager.getManager().getCurrentProject();
    Object ns = findNamespace();

    if (ns != null && isValidNamespace(ns)) {
      super.actionPerformed(e);
      DiagramSettings settings = p.getProjectSettings().getDefaultDiagramSettings();
      ArgoDiagram diagram = createDiagram(ns, settings);
      assert (diagram != null) : "No diagram was returned by the concrete class";

      p.addMember(diagram);
      // TODO: make the explorer listen to project member property
      // changes...  to eliminate coupling on gui.
      ExplorerEventAdaptor.getInstance().modelElementAdded(diagram.getNamespace());
      TargetManager.getInstance().setTarget(diagram);
    } else {
      LOG.error("No valid namespace found");
      throw new IllegalStateException("No valid namespace found");
    }
  }
 /**
  * This default implementation simply requests the default notation.
  *
  * @see org.argouml.notation.NotationContext#getContextNotation()
  * @deprecated by MVW in V0.21.3. Replaced by {@link ProjectSettings#getNotationName()}
  */
 public NotationName getContextNotation() {
   Project p = ProjectManager.getManager().getCurrentProject();
   return p.getProjectSettings().getNotationName();
 }