svn commit: r13052 - trunk/src_new/org/argouml/uml/ui/ActionStateDiagram.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2007-07-10 14:13:54-0700
New Revision: 13052

Modified:
   trunk/src_new/org/argouml/uml/ui/ActionStateDiagram.java

Log:
Use more opaque DiagramFactory create method.

Get root model from model instead of project

Modified: trunk/src_new/org/argouml/uml/ui/ActionStateDiagram.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ui/ActionStateDiagram.java?view=diff&rev=13052&p1=trunk/src_new/org/argouml/uml/ui/ActionStateDiagram.java&p2=trunk/src_new/org/argouml/uml/ui/ActionStateDiagram.java&r1=13051&r2=13052
==============================================================================
--- trunk/src_new/org/argouml/uml/ui/ActionStateDiagram.java	(original)
+++ trunk/src_new/org/argouml/uml/ui/ActionStateDiagram.java	2007-07-10 14:13:54-0700
@@ -24,15 +24,12 @@
 
 package org.argouml.uml.ui;
 
-import java.util.Collection;
-import java.util.Iterator;
-
 import org.argouml.kernel.Project;
 import org.argouml.kernel.ProjectManager;
 import org.argouml.model.Model;
 import org.argouml.ui.targetmanager.TargetManager;
-import org.argouml.uml.diagram.ArgoDiagram;
 import org.argouml.uml.diagram.DiagramFactory;
+import org.argouml.uml.diagram.ArgoDiagram;
 import org.argouml.uml.diagram.state.ui.UMLStateDiagram;
 
 /**
@@ -51,10 +48,11 @@
      * @see org.argouml.uml.ui.ActionNewDiagram#createDiagram()
      */
     protected ArgoDiagram createDiagram() {
-        Project p = ProjectManager.getManager().getCurrentProject();
         Object target = TargetManager.getInstance().getModelTarget();
         Object machine = null;
-        Object namespace = p.getRoot(); // the root model
+        Object namespace = Model.getModelManagementFactory().getRootModel();
+//      Project p = ProjectManager.getManager().getCurrentProject();
+//      Object namespace = p.getRoot(); // the root model
         if (Model.getStateMachinesHelper().isAddingStatemachineAllowed(
               target)) {
             /* The target is a valid context. */
@@ -78,17 +76,14 @@
         }
         
         return DiagramFactory.getInstance().createDiagram(
-                UMLStateDiagram.class,
+                DiagramFactory.DiagramType.State,
                 Model.getFacade().getNamespace(machine),
                 machine);
     }
     
     private boolean hasNoDiagramYet(Object machine) {
         Project p = ProjectManager.getManager().getCurrentProject();
-        Collection c = p.getDiagrams();
-        Iterator i = c.iterator();
-        while (i.hasNext()) {
-            ArgoDiagram d = (ArgoDiagram) i.next();
+        for (ArgoDiagram d : p.getDiagramList()) {
             if (d instanceof UMLStateDiagram) {
                 if (((UMLStateDiagram) d).getStateMachine() == machine) {
                     return false;
@@ -103,4 +98,4 @@
      */
     private static final long serialVersionUID = -5197718695001757808L;
 
-} /* end class ActionStateDiagram */
+}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.