svn commit: r18253 - trunk/src/argouml-app/src/org/argouml/profile: . internal

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: tfmorris
Date: 2010-04-13 10:53:31-0700
New Revision: 18253

Modified:
   trunk/src/argouml-app/src/org/argouml/profile/ProfileFacade.java
   trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java

Log:
Remove loaded profiles on reset

Modified: trunk/src/argouml-app/src/org/argouml/profile/ProfileFacade.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/profile/ProfileFacade.java?view=diff&pathrev=18253&r1=18252&r2=18253
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/profile/ProfileFacade.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/profile/ProfileFacade.java	2010-04-13 10:53:31-0700
@@ -1,13 +1,14 @@
 /* $Id$
  *****************************************************************************
- * Copyright (c) 2009 Contributors - see below
+ * Copyright (c) 2007,2010 Contributors - see below
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
  *
  * Contributors:
- *    tfmorris
+ *    maurelio1234 - initial implementation
+ *    Tom Morris
  *****************************************************************************
  *
  * Some portions of this file was previously release using the BSD License:
@@ -94,10 +95,27 @@
     }
 
     /**
+     * Remove all registered profiles.
+     */
+    static void removeAllProfiles() {
+        if (manager != null) {
+            Profile[] profiles = manager.getRegisteredProfiles().toArray(
+                    new Profile[0]);
+            for (Profile p : profiles) {
+                try {
+                    manager.removeProfile(p);
+                } catch (InvalidElementException e) {
+                    LOG.debug("Attempted to delete extent twice in removeAllProfiles " + p);
+                }
+            }
+        }
+    }
+    
+    /**
      * Reset profile subsystem to initial state (primarily for testing).
      */
     public static void reset() {
-//        removeAllProfiles();
+        removeAllProfiles();
         manager = null;
     }
 

Modified: trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java?view=diff&pathrev=18253&r1=18252&r2=18253
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/profile/internal/ProfileManagerImpl.java	2010-04-13 10:53:31-0700
@@ -302,7 +302,7 @@
             defaultProfiles.remove(p);
         }
         try {
-            Collection packages = p.getProfilePackages();
+            Collection packages = p.getLoadedPackages();
             if (packages != null && !packages.isEmpty()) {
                 // We assume profile is contained in a single extent
                 Model.getUmlFactory().deleteExtent(packages.iterator().next());

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

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.