svn commit: r16221 - trunk/src/argouml-app: src/org/argouml/kernel tests/org/argouml/kernel

Tom Morris <[email protected]>
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2008-12-02 08:04:57-0800
New Revision: 16221

Modified:
   trunk/src/argouml-app/src/org/argouml/kernel/Project.java
   trunk/src/argouml-app/src/org/argouml/kernel/ProjectImpl.java
   trunk/src/argouml-app/src/org/argouml/kernel/ProjectManager.java
   trunk/src/argouml-app/tests/org/argouml/kernel/TestProject.java
   trunk/src/argouml-app/tests/org/argouml/kernel/TestProjectSettings.java

Log:
Issue 4814: Add API basics to support multiple open projects.  Remove old deprecated methods
http://argouml.tigris.org/issues/show_bug.cgi?id=4814

Modified: trunk/src/argouml-app/src/org/argouml/kernel/Project.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/kernel/Project.java?view=diff&pathrev=16221&r1=16220&r2=16221
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/kernel/Project.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/kernel/Project.java	2008-12-02 08:04:57-0800
@@ -30,9 +30,7 @@
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
-import java.util.Vector;
 
-import org.argouml.profile.Profile;
 import org.argouml.uml.diagram.ArgoDiagram;
 import org.tigris.gef.presentation.Fig;
 
@@ -72,7 +70,9 @@
      * Don't use this directly! Use instead:
      * {@link org.argouml.persistence.PersistenceManager
      * #setProjectURI(URI, Project)}
-     *
+     * <p>
+     * TODO: Why isn't this deprecated or private if it is not to be used?
+     * 
      * @param theUri The URI to set.
      */
     public void setUri(final URI theUri);
@@ -388,8 +388,12 @@
     public Object getInitialTarget();
 
     /**
-     * @return the VetoableChangeSupport
+     * @return the VetoableChangeSupport object
+     * @see VetoableChangeSupport
+     * @deprecated for 0.27.3 by tfmorris. This appears to be unused anywhere in
+     *             ArgoUML. Speak up now if you need it.
      */
+    @Deprecated
     public VetoableChangeSupport getVetoSupport();
 
     /**
@@ -427,52 +431,20 @@
      *
      * @param obj The object to be deleted
      * @see org.argouml.kernel.ProjectImpl#trashInternal(Object)
+     * <p> 
+     * TODO: This should just be named delete() or something which better 
+     * tells what it does (since there really isn't a trash can).
      */
     public void moveToTrash(Object obj);
 
     /**
      * @param obj the object
      * @return true if the object is trashed
-     */
-    public boolean isInTrash(Object obj);
-
-    /**
-     * This method is unsupported and will thrown an
-     * UnsupportedOperationException. The profile subsystem has change
-     * completely for ArgoUML 0.26 and code which called this method must be
-     * revised to use the new Profile subsystem. See
-     * {@link ProfileConfiguration} and {@link Profile}. Set the given model as
-     * the current profile.
-     * 
-     * @param theDefaultModel a uml model
-     * @deprecated for 0.25.4 by tfmorris. Use {@link ProfileConfiguration}.
+     * @deprecated for 0.27.3 by tfmorris. Not actually implemented. The
+     *             (future) Undo facility is a better way to handle this.
      */
     @Deprecated
-    public void setDefaultModel(final Object theDefaultModel);
-
-
-    /**
-     * Get the profile (also known as default model).
-     * <p>
-     * <em>NOTE:</em>The profile or default model handling has changed
-     * <em>significantly</em> since 0.24. In addition to now supporting
-     * multiple profiles, hierarchical profiles and a number of other features,
-     * profile elements are now referenced directly rather than being copied
-     * into the user model as they were in 0.24 and earlier versions.
-     * 
-     * @return the first profile package in the search order (typically the
-     *         standard UML model without any of the Java additions which were
-     *         present in ArgoUML 0.24 and earlier.  Equivalent to 
-     *         getProfile().getProfilePackages().get(0) where getProfile is
-     *         equivalent to getProfileConfiguration().getProfiles().get(0)
-     * 
-     * @deprecated for 0.25.4 by tfmorris. Use
-     *             {@link #getProfileConfiguration()} followed by methods from
-     *             {@link ProfileConfiguration} such as
-     *             {@link ProfileConfiguration#getProfiles()}.
-     */
-    @Deprecated
-    public Object getDefaultModel();
+    public boolean isInTrash(Object obj);
 
 
     /**
@@ -509,7 +481,6 @@
     @Deprecated
     public void setRoot(final Object root);
 
-
     /**
      * Return a collection of top level Model Elements. Normally for ArgoUML
      * created models, this will be a single Package or Model, but other tools
@@ -535,14 +506,6 @@
      */
     public boolean isValidDiagramName(String name);
 
-    /**
-     * Returns the searchpath.
-     * @return Vector
-     * @deprecated for 0.25.4 by tfmorris.  Use {@link #getSearchPathList()}.
-     */
-    // TODO: Unused?
-    @Deprecated
-    public Vector<String> getSearchpath();
 
     /**
      * Returns the uri.
@@ -557,24 +520,23 @@
     public Map<String, Object> getUUIDRefs();
 
     /**
-     * Sets the searchpath.
-     * @param theSearchpath The searchpath to set
-     * @deprecated for 0.25.4 by tfmorris. Use {@link #setSearchPath(List)}.
-     */
-    // TODO: Unused?
-    @Deprecated
-    public void setSearchpath(final Vector<String> theSearchpath);
-
-    /**
      * Sets the uUIDRefs.
      * @param uUIDRefs The uUIDRefs to set
      */
     public void setUUIDRefs(final Map<String, Object> uUIDRefs);
 
     /**
-     * Sets the vetoSupport.
+     * Sets the VetoableChangeSupport object. This will be returned by
+     * {@link #getVetoSupport()} but is otherwise unused.
+     * <p>
+     * TODO: Why is this here since it's never used? - tfm
+     * 
      * @param theVetoSupport The vetoSupport to set
+     * @see VetoableChangeSupport
+     * @deprecated for 0.27.3 by tfmorris. This appears to be unused anywhere in
+     *             ArgoUML. Speak up now if you need it.
      */
+    @Deprecated
     public void setVetoSupport(VetoableChangeSupport theVetoSupport);
 
     /**
@@ -626,21 +588,6 @@
     public void setPersistenceVersion(int pv);
 
     /**
-     * Get the default profile. For backward compatibility only.  Typically it
-     * will return the UML standard profile which is a subset of the combined
-     * UML 1.4 plus Java plus ArgoUML profile which was the default with
-     * ArgoUML 0.24 and earlier.
-     * 
-     * @return Returns the first profile in the search order. Equivalent to
-     *         getProfileConfiguration().getProfiles().get(0).
-     * @deprecated for 0.25.4 by maurelio1234. Use
-     *             {@link #getProfileConfiguration()} and
-     *             {@link ProfileConfiguration#getProfiles()} instead.
-     */
-    @Deprecated
-    public Profile getProfile();
-
-    /**
      * Repair all parts of the project before a save takes place.
      * @return a report of any fixes
      */
@@ -673,5 +620,18 @@
      * @return the UndoManager for this project
      */
     public UndoManager getUndoManager();
+    
+    /**
+     * @return true if Project has been modified since last save
+     */
+    public boolean isDirty();
+    
+    /**
+     * Set the dirty flag for the project.  This has no direct effect other than
+     * setting the flag.
+     * 
+     * @param isDirty true if the project should be marked as dirty
+     */
+    public void setDirty(boolean isDirty);
 
 }
\ No newline at end of file

Modified: trunk/src/argouml-app/src/org/argouml/kernel/ProjectImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/kernel/ProjectImpl.java?view=diff&pathrev=16221&r1=16220&r2=16221
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/kernel/ProjectImpl.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/kernel/ProjectImpl.java	2008-12-02 08:04:57-0800
@@ -39,7 +39,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.Vector;
 
 import org.apache.log4j.Logger;
 import org.argouml.application.api.Argo;
@@ -49,7 +48,6 @@
 import org.argouml.model.InvalidElementException;
 import org.argouml.model.Model;
 import org.argouml.profile.Profile;
-import org.argouml.profile.ProfileException;
 import org.argouml.profile.ProfileFacade;
 import org.argouml.uml.CommentEdge;
 import org.argouml.uml.ProjectMemberModel;
@@ -68,9 +66,6 @@
  */
 public class ProjectImpl implements java.io.Serializable, Project {
 
-    /**
-     * Logger.
-     */
     private static final Logger LOG = Logger.getLogger(ProjectImpl.class);
 
     /**
@@ -119,7 +114,6 @@
     
     private Object root;
     private final Collection roots = new HashSet();
-    
 
     /**
      * Instances of the UML diagrams.
@@ -150,6 +144,8 @@
     // TODO: Change this to use an UndoManager instance per project when
     // GEF has been enhanced.
     private UndoManager undoManager = DefaultUndoManager.getInstance();
+
+    private boolean dirty = false;
     
     /**
      * Constructor.
@@ -346,6 +342,9 @@
         roots.add(model);
         setCurrentNamespace(model);
         setSaveEnabled(true);
+        if (models.size() > 1 || roots.size() > 1) {
+            LOG.debug("Multiple roots/models");
+        }
     }
 
     /**
@@ -476,12 +475,6 @@
     }
 
 
-    @SuppressWarnings({ "deprecation", "unchecked" })
-    public Vector getUserDefinedModels() {
-        return new Vector(models);
-    }
-
-
     public List getUserDefinedModelList() {
         return models;
     }
@@ -502,6 +495,7 @@
     }
 
 
+    @SuppressWarnings("deprecation")
     @Deprecated
     public Object getModel() {
         if (models.size() != 1) {
@@ -618,6 +612,7 @@
     }
 
 
+    @SuppressWarnings("deprecation")
     @Deprecated
     public void setCurrentNamespace(final Object m) {
 
@@ -629,11 +624,13 @@
     }
 
 
+    @SuppressWarnings("deprecation")
     @Deprecated
     public Object getCurrentNamespace() {
         return currentNamespace;
     }
 
+
     public List<ArgoDiagram> getDiagramList() {
         return Collections.unmodifiableList(diagrams);
     }
@@ -736,6 +733,8 @@
     }
 
 
+    @SuppressWarnings("deprecation")
+    @Deprecated
     public VetoableChangeSupport getVetoSupport() {
         if (vetoSupport == null) {
             vetoSupport = new VetoableChangeSupport(this);
@@ -748,7 +747,6 @@
         for (ArgoDiagram diagram : diagrams) {
             diagram.preSave();
         }
-        // TODO: is preSave needed for models?
     }
 
 
@@ -756,7 +754,6 @@
         for (ArgoDiagram diagram : diagrams) {
             diagram.postSave();
         }
-        // TODO: is postSave needed for models?
         setSaveEnabled(true);
     }
 
@@ -788,7 +785,7 @@
     /**
      * Empty the trash can and permanently delete all objects that it contains.
      */
-    public void emptyTrashCan() {
+    private void emptyTrashCan() {
         trashcan.clear();
     }
 
@@ -814,6 +811,8 @@
      * @param obj the object to be thrown away
      */
     protected void trashInternal(Object obj) {
+        // TODO: This should only be checking for the top level package
+        // (if anything at all)
         if (Model.getFacade().isAModel(obj)) {
             return; //Can not delete the model
         }
@@ -834,6 +833,7 @@
             }
         } else if (obj instanceof ArgoDiagram) {
             removeProjectMemberDiagram((ArgoDiagram) obj);
+            // TODO: Is the following still true?  fix it there! - tfm
             // Need to manually delete diagrams from explorer because they
             // don't have a decent event system set up:
             ProjectManager.getManager()
@@ -847,6 +847,7 @@
             // for primitive Figs (without owner).
             LOG.info("Request to delete a Fig " + obj.getClass().getName());
         } else if (obj instanceof CommentEdge) {
+            // TODO: Why is this a special case? - tfm
             CommentEdge ce = (CommentEdge) obj;
             LOG.info("Removing the link from " + ce.getAnnotatedElement()
                     + " to " + ce.getComment());
@@ -855,53 +856,14 @@
     }
 
 
+    @SuppressWarnings("deprecation")
+    @Deprecated
     public boolean isInTrash(Object obj) {
         return trashcan.contains(obj);
     }
 
 
-    @SuppressWarnings("deprecation")
-    public void setDefaultModel(final Object theDefaultModel) {
-        // We could attempt to create a profile with the model and add it
-        // to the configuration, but the chances of it working anything like
-        // the user expects are almost nil, so we'll just punt.
-        throw new UnsupportedOperationException(
-                "Old style profiles not supported."
-                        + "Please see the documentation for "
-                        + "ProfileConfiguration");
-    }
-
-
-    @SuppressWarnings("deprecation")
-    public Object getDefaultModel() {
 
-        // Do our best to return something which looks vaguely like old code
-        // might have expected.  Hopefully no one is using this...
-        
-        Collection profilePackages;
-        try {
-            profilePackages = getProfile().getProfilePackages();
-        } catch (ProfileException e) {
-            LOG.error("Failed to get profile", e);
-            return null;
-        }
-        
-        // First priority is Model for best backward compatibility
-        for (Object pkg : profilePackages) {
-            if (Model.getFacade().isAModel(pkg)) {
-                return pkg;
-            }
-        }
-        // then a Package
-        for (Object pkg : profilePackages) {
-            if (Model.getFacade().isAPackage(pkg)) {
-                return pkg;
-            }
-        }
-        // if all else fails, just the first element
-        return profilePackages.iterator().next();
-    }
-    
     public Object findTypeInDefaultModel(String name) {
         if (defaultModelTypeCache.containsKey(name)) {
             return defaultModelTypeCache.get(name);
@@ -943,6 +905,7 @@
         // TODO: We don't really want to do the following, but I'm not sure
         // what depends on it - tfm - 20070725
         Model.getModelManagementFactory().setRootModel(theRoot);
+        // TODO: End up with multiple models here
         addModelInternal(theRoot);
         roots.clear();
         roots.add(theRoot);
@@ -985,26 +948,11 @@
     }
 
 
-    @SuppressWarnings("deprecation")
-    @Deprecated
-    public Vector<String> getSearchpath() {
-        return new Vector(searchpath);
-    }
-
-
     public Map<String, Object> getUUIDRefs() {
         return uuidRefs;
     }
 
-
-    @SuppressWarnings("deprecation")
-    @Deprecated
-    public void setSearchpath(final Vector<String> theSearchpath) {
-        searchpath.clear();
-        searchpath.addAll(theSearchpath);
-    }
-
-
+    
     public void setSearchPath(final List<String> theSearchpath) {
         searchpath.clear();
         searchpath.addAll(theSearchpath);
@@ -1015,17 +963,23 @@
     }
 
 
+    @SuppressWarnings("deprecation")
+    @Deprecated
     public void setVetoSupport(VetoableChangeSupport theVetoSupport) {
         vetoSupport = theVetoSupport;
     }
 
 
+    @SuppressWarnings("deprecation")
+    @Deprecated
     public ArgoDiagram getActiveDiagram() {
         return activeDiagram;
     }
 
 
 
+    @SuppressWarnings("deprecation")
+    @Deprecated
     public void setActiveDiagram(final ArgoDiagram theDiagram) {
         activeDiagram = theDiagram;
     }
@@ -1088,13 +1042,6 @@
     }
 
 
-    @SuppressWarnings("deprecation")
-    @Deprecated
-    public Profile getProfile() {
-        return getProfileConfiguration().getProfiles().get(0);
-    }
-
-
     public String repair() {
         StringBuilder report = new StringBuilder();
         Iterator it = members.iterator();
@@ -1131,4 +1078,17 @@
         ProfileFacade.applyConfiguration(pc);
     }
 
+    public boolean isDirty() {
+        // TODO: Placeholder implementation until support for tracking on
+        // a per-project basis is implemented
+//        return dirty;
+        return ProjectManager.getManager().isSaveActionEnabled();
+    }
+    
+    public void setDirty(boolean isDirty) {
+        // TODO: Placeholder implementation until support for tracking on
+        // a per-project basis is implemented
+        dirty = isDirty;
+        ProjectManager.getManager().setSaveEnabled(isDirty);
+    }
 }

Modified: trunk/src/argouml-app/src/org/argouml/kernel/ProjectManager.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/kernel/ProjectManager.java?view=diff&pathrev=16221&r1=16220&r2=16221
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/kernel/ProjectManager.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/kernel/ProjectManager.java	2008-12-02 08:04:57-0800
@@ -28,6 +28,7 @@
 import java.beans.PropertyChangeListener;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.LinkedList;
 import java.util.List;
 
 import javax.swing.Action;
@@ -94,6 +95,8 @@
      * The project that is visible in the projectbrowser.
      */
     private static Project currentProject;
+    
+    private static LinkedList<Project> openProjects = new LinkedList<Project>();
 
     /**
      * Flag to indicate we are creating a new current project.
@@ -203,6 +206,7 @@
     public void setCurrentProject(Project newProject) {
         Project oldProject = currentProject;
         currentProject = newProject;
+        addProject(newProject);
         if (currentProject != null
             && currentProject.getActiveDiagram() == null) {
             List<ArgoDiagram> diagrams = currentProject.getDiagramList();
@@ -363,7 +367,7 @@
     /**
      * @return true is the save action is currently enabled
      * <p>
-     * TODO: This needs to get the save-enabled status for the current project.
+     * @deprecated for 0.27.2 by tfmorris.  Use {@link Project#isDirty()}.
      */
     public boolean isSaveActionEnabled() {
         return this.saveAction.isEnabled();
@@ -374,8 +378,8 @@
      * current project's save state has changed. There are 2 receivers:
      * the SaveProject tool icon and the title bar (for showing a *).
      * <p>
-     * TODO: This needs to be managed on a per-project basis.
-     * @param newValue The new state.
+     * @deprecated for 0.27.2 by tfmorris.  Use 
+     * {@link Project#setDirty(boolean)}.
      */
     public void setSaveEnabled(boolean newValue) {
         if (saveAction != null) {
@@ -383,14 +387,25 @@
         }
     }
 
+    private void addProject(Project newProject) {
+        openProjects.addLast(newProject);
+    }
+    
     /**
      * Remove the project.
      *
      * @param oldProject The project to be removed.
      */
     public void removeProject(Project oldProject) {
+        openProjects.remove(oldProject);
+        
+        // TODO: This code can be removed when getCurrentProject is removed
         if (currentProject == oldProject) {
-            currentProject = null;
+            if (openProjects.size() > 0) {
+                currentProject = openProjects.getLast();
+            } else {
+                currentProject = null;
+            }
         }
         oldProject.remove();
     }

Modified: trunk/src/argouml-app/tests/org/argouml/kernel/TestProject.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/tests/org/argouml/kernel/TestProject.java?view=diff&pathrev=16221&r1=16220&r2=16221
==============================================================================
--- trunk/src/argouml-app/tests/org/argouml/kernel/TestProject.java	(original)
+++ trunk/src/argouml-app/tests/org/argouml/kernel/TestProject.java	2008-12-02 08:04:57-0800
@@ -57,6 +57,12 @@
 
 
 /**
+ * TODO: This whole class needs to be updated to remove use of deprecated
+ * methods and (hopefully) test multi-root and multi-project methods.
+ * 
+ * TODO: This whole class needs to be updated to remove use of deprecated
+ * methods and (hopefully) test multi-root and multi-project methods.
+ * 
  * @since Nov 17, 2002
  * @author [email protected]
  */
@@ -75,7 +81,7 @@
      * Test the makeUntitledProject() function.
      */
     public void testMakeUntitledProject() {
-        Project p = ProjectManager.getManager().getCurrentProject();
+        Project p = ProjectManager.getManager().getOpenProjects().get(0);
         assertEquals(2, p.getDiagramList().size());
         assertEquals(Translator.localize("misc.untitled-model"), 
                 Model.getFacade().getName(p.getModel()));
@@ -123,7 +129,7 @@
      * Test the moveToTrash function for package and content.
      */
     public void testTrashcanPackageContent() {
-        Project p = ProjectManager.getManager().getCurrentProject();
+        Project p = ProjectManager.getManager().getOpenProjects().get(0);
         // test with a class in a package
         Object package1 =
             Model.getModelManagementFactory().buildPackage("test1");
@@ -160,7 +166,7 @@
      * Test the moveToTrash function for class and content.
      */
     public void testTrashcanClassContent() {
-        Project p = ProjectManager.getManager().getCurrentProject();
+        Project p = ProjectManager.getManager().getOpenProjects().get(0);
         // test with a class and an inner class
         Object aClass = Model.getCoreFactory().buildClass("Test", p.getRoot());
         Object cls1 = Model.getCoreFactory().buildClass(aClass);
@@ -193,7 +199,7 @@
      * The diagram should be deleted, too.
      */
     public void testDeletePackageWithClassDiagram() {
-        Project p = ProjectManager.getManager().getCurrentProject();
+        Project p = ProjectManager.getManager().getOpenProjects().get(0);
         assertEquals(2, p.getDiagramList().size());
         assertEquals(Translator.localize("misc.untitled-model"), 
                 Model.getFacade().getName(p.getModel()));
@@ -225,7 +231,7 @@
      * The diagram should be deleted, too.
      */
     public void testDeleteClassWithStateDiagram() {
-        Project p = ProjectManager.getManager().getCurrentProject();
+        Project p = ProjectManager.getManager().getOpenProjects().get(0);
         assertEquals(2, p.getDiagramList().size());
 
         int sizeMembers = p.getMembers().size();
@@ -264,7 +270,7 @@
      * Test deleting a statechart diagram directly.
      */
     public void testDeleteStateDiagram() {
-        Project p = ProjectManager.getManager().getCurrentProject();
+        Project p = ProjectManager.getManager().getOpenProjects().get(0);
         assertEquals(2, p.getDiagramList().size());
 
         int sizeMembers = p.getMembers().size();
@@ -299,7 +305,7 @@
      * The inner class should be deleted, too.
      */
     public void testDeleteClassWithInnerClass() {
-        Project p = ProjectManager.getManager().getCurrentProject();
+        Project p = ProjectManager.getManager().getOpenProjects().get(0);
         assertEquals(2, p.getDiagramList().size());
 
         // test with a class and an inner class
@@ -319,7 +325,7 @@
      * The class should be deleted, too.
      */
     public void testDeletePackageWithClass() {
-        Project p = ProjectManager.getManager().getCurrentProject();
+        Project p = ProjectManager.getManager().getOpenProjects().get(0);
         assertEquals(2, p.getDiagramList().size());
 
         // test with a class and class diagram
@@ -340,7 +346,7 @@
      * The diagram should be deleted, too.
      */
     public void testDeletePackageWithStateDiagram() {
-        Project p = ProjectManager.getManager().getCurrentProject();
+        Project p = ProjectManager.getManager().getOpenProjects().get(0);
         assertEquals(2, p.getDiagramList().size());
 
         int sizeMembers = p.getMembers().size();
@@ -379,7 +385,7 @@
      * The diagram should be deleted, too.
      */
     public void testDeleteOperationWithStateDiagram() {
-        Project p = ProjectManager.getManager().getCurrentProject();
+        Project p = ProjectManager.getManager().getOpenProjects().get(0);
         assertEquals(2, p.getDiagramList().size());
 
         int sizeMembers = p.getMembers().size();
@@ -427,7 +433,7 @@
      * The diagram should be deleted, too.
      */
     public void testDeletePackageWithClassWithActivityDiagram() {
-        Project p = ProjectManager.getManager().getCurrentProject();
+        Project p = ProjectManager.getManager().getOpenProjects().get(0);
         assertEquals(2, p.getDiagramList().size());
 
         int sizeMembers = p.getMembers().size();
@@ -466,7 +472,7 @@
      * The diagram should be deleted, too.
      */
     public void testDeletePackageWithPackageWithActivityDiagram() {
-        Project p = ProjectManager.getManager().getCurrentProject();
+        Project p = ProjectManager.getManager().getOpenProjects().get(0);
         assertEquals(2, p.getDiagramList().size());
 
         int sizeMembers = p.getMembers().size();
@@ -506,7 +512,7 @@
      * See issue 1671.
      */
     public void testAddSearchPath() {
-        Project p = ProjectManager.getManager().getCurrentProject();
+        Project p = ProjectManager.getManager().getOpenProjects().get(0);
         assertNotNull(p.getSearchPathList());
         assertTrue(p.getSearchPathList().size() == 1);
         
@@ -527,7 +533,6 @@
     protected void setUp() throws Exception {
         super.setUp();
         InitializeModel.initializeDefault();
-        ProjectManager.getManager().setCurrentProject(null);
         (new InitNotation()).init();
         (new InitNotationUml()).init();
         (new InitNotationJava()).init();
@@ -540,5 +545,6 @@
         (new InitClassDiagram()).init();
         (new InitUseCaseDiagram()).init();
         (new InitProfileSubsystem()).init();
+        ProjectManager.getManager().makeEmptyProject();
     }
 }

Modified: trunk/src/argouml-app/tests/org/argouml/kernel/TestProjectSettings.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/tests/org/argouml/kernel/TestProjectSettings.java?view=diff&pathrev=16221&r1=16220&r2=16221
==============================================================================
--- trunk/src/argouml-app/tests/org/argouml/kernel/TestProjectSettings.java	(original)
+++ trunk/src/argouml-app/tests/org/argouml/kernel/TestProjectSettings.java	2008-12-02 08:04:57-0800
@@ -374,7 +374,7 @@
         (new InitNotationUml()).init();
         (new InitNotationJava()).init();
         /* Needed for initialisations: */
-        ProjectManager.getManager().getCurrentProject();
+        ProjectManager.getManager().makeEmptyProject();
     }
 
     /**

------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=518286

To unsubscribe from this discussion, e-mail: [[email protected]].
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.