svn commit: r15023 - trunk/src/argouml-app/src/org/argouml/uml/ui/ActionActivityDiagram.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2008-06-21 09:31:10-0700
New Revision: 15023

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/ui/ActionActivityDiagram.java

Log:
Simplify flow of control.  Remove redundant code.

Modified: trunk/src/argouml-app/src/org/argouml/uml/ui/ActionActivityDiagram.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/ui/ActionActivityDiagram.java?view=diff&rev=15023&p1=trunk/src/argouml-app/src/org/argouml/uml/ui/ActionActivityDiagram.java&p2=trunk/src/argouml-app/src/org/argouml/uml/ui/ActionActivityDiagram.java&r1=15022&r2=15023
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/ui/ActionActivityDiagram.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/ui/ActionActivityDiagram.java	2008-06-21 09:31:10-0700
@@ -1,5 +1,5 @@
 // $Id$
-// Copyright (c) 1996-2007 The Regents of the University of California. All
+// Copyright (c) 1996-2008 The Regents of the University of California. All
 // Rights Reserved. Permission to use, copy, modify, and distribute this
 // software and its documentation without fee, and without a written
 // agreement is hereby granted, provided that the above copyright notice
@@ -55,22 +55,14 @@
      * @return the newly created and initialized diagram
      */
     protected ArgoDiagram createDiagram(Object namespace) {
-        Object target = TargetManager.getInstance().getModelTarget();
-        Object graph = null;
-
-        if (Model.getActivityGraphsHelper().isAddingActivityGraphAllowed(
-                target)) {
-            /* The target is a valid context */
-            graph = Model.getActivityGraphsFactory().buildActivityGraph(target);
-        } else {
-            graph = Model.getActivityGraphsFactory().createActivityGraph();
-            if (Model.getFacade().isANamespace(target)) {
-                namespace = target;
-            }
-            Model.getCoreHelper().setNamespace(graph, namespace);
-            Model.getStateMachinesFactory()
-                .buildCompositeStateOnStateMachine(graph);
-        }
+        Object context = TargetManager.getInstance().getModelTarget();
+        
+        if (!Model.getActivityGraphsHelper().isAddingActivityGraphAllowed(
+                context)) {
+            context = namespace;
+        } 
+        Object graph = 
+            Model.getActivityGraphsFactory().buildActivityGraph(context);
 
         return DiagramFactory.getInstance().createDiagram(
                 DiagramFactory.DiagramType.Activity,
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.