svn commit: r13363 - branches/gsoc2007/maurelio1234/branch2: src/model-euml/src/org/argouml/model/euml src/model-mdr/src/org/argouml/model/mdr src/model/src/org/argouml/model src_new/org/argouml/kernel src_new/org/argouml/ui src_new/org/argouml/ui/cmd src_new/org/argouml/ui/targetmanager src_new/org/argouml/uml/diagram/ui src_new/org/argouml/uml/ui src_new/org/argouml/uml/ui/behavior/collaborations src_new/org/argouml/uml/ui/foundation/core src_new/org/argouml/uml/ui/foundation/extension_mechanisms tests/org/argouml/persistence tests/testmodels/uml14

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: maurelio1234
Date: 2007-08-15 06:35:42-0700
New Revision: 13363

Added:
   branches/gsoc2007/maurelio1234/branch2/tests/testmodels/uml14/LinkedProfile.zargo
      - copied unchanged from r13362, /trunk/tests/testmodels/uml14/LinkedProfile.zargo
Modified:
   branches/gsoc2007/maurelio1234/branch2/src/model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java
   branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/CoreFactoryMDRImpl.java
   branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/FacadeMDRImpl.java
   branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/ModelEventPumpMDRImpl.java
   branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/XmiReaderImpl.java
   branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/XmiReferenceResolverImpl.java
   branches/gsoc2007/maurelio1234/branch2/src/model/src/org/argouml/model/Facade.java
   branches/gsoc2007/maurelio1234/branch2/src/model/src/org/argouml/model/Model.java
   branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/kernel/ProjectImpl.java
   branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/kernel/ProjectSettings.java
   branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/ProjectBrowser.java
   branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/cmd/CmdSetPreferredSize.java
   branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/targetmanager/TargetManager.java
   branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/diagram/ui/FigAssociationClass.java
   branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/TabProps.java
   branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/UMLCheckBox2.java
   branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/UMLComboBoxModel2.java
   branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/behavior/collaborations/UMLAssociationRoleBaseComboBoxModel.java
   branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/foundation/core/UMLClassifierAssociationEndListModel.java
   branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLMetaClassComboBoxModel.java
   branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLStereotypeTagDefinitionListModel.java
   branches/gsoc2007/maurelio1234/branch2/tests/org/argouml/persistence/TestZargoFilePersister.java

Log:
merging up to revision 13349

Modified: branches/gsoc2007/maurelio1234/branch2/src/model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src/model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java?view=diff&rev=13363&p1=branches/gsoc2007/maurelio1234/branch2/src/model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java&p2=branches/gsoc2007/maurelio1234/branch2/src/model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java&r1=13362&r2=13363
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src/model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src/model-euml/src/org/argouml/model/euml/FacadeEUMLImpl.java	2007-08-15 06:35:42-0700
@@ -136,6 +136,11 @@
         modelImpl = implementation;
     }
 
+    public String getUmlVersion() {
+        // TODO: Can we get this from the metamodel?
+        return "2.1.1";
+    }
+    
     public boolean equalsPseudostateKind(Object ps1, Object ps2) {
         throw new NotYetImplementedException();
 

Modified: branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/CoreFactoryMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/CoreFactoryMDRImpl.java?view=diff&rev=13363&p1=branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/CoreFactoryMDRImpl.java&p2=branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/CoreFactoryMDRImpl.java&r1=13362&r2=13363
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/CoreFactoryMDRImpl.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/CoreFactoryMDRImpl.java	2007-08-15 06:35:42-0700
@@ -1029,11 +1029,6 @@
             }
         }
 
-        // TODO: What well-formedness rule is this?
-        if (parent.getNamespace() == null) {
-            throw new IllegalArgumentException("parent has no namespace");
-        }
-        
         // TODO: This is well-formedness rule from UML1.4.2
         // 4.5.3.20 [2] No GeneralizableElement can have a parent
         // Generalization to an element that is a leaf.
@@ -1052,7 +1047,11 @@
         Generalization gen = createGeneralization();
         gen.setParent(parent);
         gen.setChild(child);
-        gen.setNamespace(parent.getNamespace());
+        if (child.getNamespace() != null) {
+            gen.setNamespace(child.getNamespace());
+        } else if (child instanceof Namespace) {
+            gen.setNamespace((Namespace) child);
+        }
         return gen;
     }
 

Modified: branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/FacadeMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/FacadeMDRImpl.java?view=diff&rev=13363&p1=branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/FacadeMDRImpl.java&p2=branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/FacadeMDRImpl.java&r1=13362&r2=13363
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/FacadeMDRImpl.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/FacadeMDRImpl.java	2007-08-15 06:35:42-0700
@@ -211,6 +211,10 @@
     public FacadeMDRImpl(MDRModelImplementation impl) {
         modelImpl = impl;
     }
+    
+    public String getUmlVersion() {
+        return "1.4";
+    }
 
     public boolean isAAbstraction(Object handle) {
         return handle instanceof Abstraction;

Modified: branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/ModelEventPumpMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/ModelEventPumpMDRImpl.java?view=diff&rev=13363&p1=branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/ModelEventPumpMDRImpl.java&p2=branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/ModelEventPumpMDRImpl.java&r1=13362&r2=13363
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/ModelEventPumpMDRImpl.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/ModelEventPumpMDRImpl.java	2007-08-15 06:35:42-0700
@@ -30,18 +30,19 @@
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
 import javax.jmi.model.Association;
 import javax.jmi.model.AssociationEnd;
+import javax.jmi.model.Attribute;
 import javax.jmi.model.GeneralizableElement;
 import javax.jmi.model.ModelElement;
 import javax.jmi.model.ModelPackage;
 import javax.jmi.model.MofClass;
 import javax.jmi.model.NameNotFoundException;
+import javax.jmi.model.Reference;
 import javax.jmi.reflect.InvalidObjectException;
 import javax.jmi.reflect.RefAssociation;
 import javax.jmi.reflect.RefObject;
@@ -106,9 +107,15 @@
     /**
      * Map of subtypes for all types in our metamodel.
      */
-    private Map subtypeMap;
+    private Map<String, Collection<String>> subtypeMap;
 
     /**
+     * Map of all valid property names (association end names & attribute names)
+     * for each class.
+     */
+    private Map<String, Collection<String>> propertyNameMap;
+    
+    /**
      * Constructor.
      *
      * @param implementation The implementation.
@@ -129,6 +136,7 @@
         modelImpl = implementation;
         repository = repo;
         subtypeMap = buildTypeMap(modelImpl.getModelPackage());
+        propertyNameMap = buildPropertyNameMap(modelImpl.getModelPackage());
     }
     
     /*
@@ -234,7 +242,7 @@
             return;
         }
 
-        List events = new ArrayList();
+        List<UmlChangeEvent> events = new ArrayList<UmlChangeEvent>();
 
         if (mdrEvent instanceof AttributeEvent) {
             AttributeEvent ae = (AttributeEvent) mdrEvent;
@@ -323,9 +331,7 @@
             }
         }
 
-        for (int i = 0; i < events.size(); i++) {
-            UmlChangeEvent event = (UmlChangeEvent) events.get(i);
-
+        for (UmlChangeEvent event : events) {
             fire(event);
             // Unregister deleted instances after all events have been delivered
             if (event instanceof DeleteInstanceEvent) {
@@ -385,7 +391,7 @@
 
         // Any given listener is only called once even if it is
         // registered for multiple relevant matches
-        Set listeners = new HashSet();
+        Set<PropertyChangeListener> listeners = new HashSet<PropertyChangeListener>();
         synchronized (lock) {
             listeners.addAll(getMatches(elements, mofId, event
                     .getPropertyName()));
@@ -408,10 +414,7 @@
         }
 
         if (!listeners.isEmpty()) {
-            Iterator it = listeners.iterator();
-            PropertyChangeListener pcl = null;
-            while (it.hasNext()) {
-                pcl = (PropertyChangeListener) it.next();
+            for (PropertyChangeListener pcl : listeners) {
                 if (false /*(LOG.isDebugEnabled()*/) {
                     LOG.debug("Firing event on " + pcl.getClass().getName()
                             + "[" + pcl + "]");
@@ -512,13 +515,12 @@
                         + "properties:" + formatArray(propertyNames)
                         + ", listener:" + listener + "]");
             }
-            Collection subtypes = (Collection) subtypeMap.get(className);
+            Collection<String> subtypes = subtypeMap.get(className);
             verifyAttributeNames(className, propertyNames);
             synchronized (lock) {
                 register(listenedClasses, listener, className, propertyNames);
-                for (Iterator i = subtypes.iterator(); i.hasNext();) {
-                    register(listenedClasses, listener, (String) i.next(),
-                            propertyNames);
+                for (String subtype : subtypes) {
+                    register(listenedClasses, listener, subtype, propertyNames);
                 }
             }
             return;
@@ -541,11 +543,11 @@
                         + ", properties:" + formatArray(propertyNames)
                         + ", listener:" + listener + "]");
             }
-            Collection subtypes = (Collection) subtypeMap.get(className);
+            Collection<String> subtypes = subtypeMap.get(className);
             synchronized (lock) {
                 unregister(listenedClasses, listener, className, propertyNames);
-                for (Iterator i = subtypes.iterator(); i.hasNext();) {
-                    unregister(listenedClasses, listener, (String) i.next(),
+                for (String subtype : subtypes) {
+                    unregister(listenedClasses, listener, subtype,
                             propertyNames);
                 }
             }
@@ -790,11 +792,10 @@
     /**
      * Traverse metamodel and build list of subtypes for every metatype.
      */
-    private HashMap buildTypeMap(ModelPackage extent) {
-        HashMap names = new HashMap();
-        for (Iterator iter = extent.getMofClass().refAllOfClass().iterator();
-                iter.hasNext();) {
-            ModelElement element = (ModelElement) iter.next();
+    private Map<String, Collection<String>> buildTypeMap(ModelPackage extent) {
+        Map<String, Collection<String>> names = new HashMap<String, Collection<String>>();
+        for (Object metaclass : extent.getMofClass().refAllOfClass()) {
+            ModelElement element = (ModelElement) metaclass;
             String name = element.getName();
             if (names.containsKey(name)) {
                 LOG.error("Found duplicate class '" + name + "' in metamodel");
@@ -812,13 +813,12 @@
      * 
      * TODO: Does this have a scalability problem?
      */
-    private Collection getSubtypes(ModelPackage extent, ModelElement me) {
-        Collection allSubtypes = new HashSet();
+    private Collection<String> getSubtypes(ModelPackage extent, ModelElement me) {
+        Collection<String> allSubtypes = new HashSet<String>();
         if (me instanceof GeneralizableElement) {
             GeneralizableElement ge = (GeneralizableElement) me;
-            Collection subtypes = extent.getGeneralizes().getSubtype(ge);
-            for (Iterator i = subtypes.iterator(); i.hasNext();) {
-                ModelElement st = (ModelElement) i.next();
+            Collection<ModelElement> subtypes = extent.getGeneralizes().getSubtype(ge);
+            for (ModelElement st : subtypes) {
                 allSubtypes.add(st.getName());
                 allSubtypes.addAll(getSubtypes(extent, st));
             }
@@ -827,6 +827,61 @@
     }
 
     /**
+     * Traverse metamodel and build list of names for all attributes and reference ends.
+     */
+    private Map<String, Collection<String>> buildPropertyNameMap(
+            ModelPackage extent) {
+        Map<String, Collection<String>> names = new HashMap<String, Collection<String>>();
+        for (Reference reference : (Collection<Reference>) extent
+                .getReference().refAllOfClass()) {
+            mapAssociationEnd(names, reference.getExposedEnd());
+            mapAssociationEnd(names, reference.getReferencedEnd());
+        }
+        for (Attribute attribute : (Collection<Attribute>) extent
+                .getAttribute().refAllOfClass()) {
+            mapPropertyName(names, attribute.getContainer(),
+                    attribute.getName());
+        }
+        return names;
+    }
+
+    private void mapAssociationEnd(Map<String, Collection<String>> names,
+            AssociationEnd end) {
+        ModelElement type = end.otherEnd().getType();
+        mapPropertyName(names, type, end.getName());
+    }
+
+    private boolean mapPropertyName(Map<String, Collection<String>> names,
+            ModelElement type, String propertyName) {
+        String typeName = type.getName();
+        boolean added = mapPropertyName(names, typeName, propertyName);
+
+        Collection<String> subtypes = subtypeMap.get(typeName);
+        if (subtypes != null) {
+            for (String subtype : subtypes) {
+                added &= mapPropertyName(names, subtype, propertyName);
+            }
+        }
+        
+        return added;
+    }
+
+    private boolean mapPropertyName(Map<String, Collection<String>> names,
+            String typeName, String propertyName) {
+        if (!names.containsKey(typeName)) {
+            names.put(typeName, new HashSet<String>());
+        }
+        boolean added = names.get(typeName).add(propertyName);
+        if (!added) {
+            LOG.debug("Duplicate property name found - " + typeName + ":"
+                    + propertyName);
+        } else {
+            LOG.debug("Added property name - " + typeName + ":" + propertyName);
+        }
+        return added;
+    }
+    
+    /**
      * Check whether given attribute names exist for this
      * metatype in the metamodel.  Throw exception if not found.
      */
@@ -848,8 +903,6 @@
             if (metaobject == null || attributes == null) {
                 return;
             }
-
-            HashSet<String> names = new HashSet<String>();
             // If we don't have a MofClass, see if we can get one from the
             // instance
             if (!(metaobject instanceof MofClass)) {
@@ -863,41 +916,28 @@
             }
 
             MofClass metaclass = (MofClass) metaobject;
-            for (MofClass superclass : (List<MofClass>)metaclass.allSupertypes()) {
-                // TODO: This won't find associations which aren't navigable in
-                // this direction
-                for (Object o : superclass.getContents()) {
-                    if (o instanceof javax.jmi.model.Reference
-                            || o instanceof javax.jmi.model.Attribute) {
-                        names.add(((javax.jmi.model.ModelElement) o).getName());
-                    }
-                }
+            Collection<String> names = propertyNameMap.get(metaclass.getName());
+            if (names == null) {
+                names = Collections.EMPTY_SET;
             }
 
             for (String attribute : attributes) {
                 if (!names.contains(attribute) 
                         && !"remove".equals(attribute)) {
-                    /*
-                     * TODO: For any names not found in the class definition,
-                     * see if we can find an association with an end of the
-                     * right name where the opposite end has the correct type .
-                     *
-                     * Perhaps instead of working from the class we should get
-                     * all associations, check the types of their association
-                     * ends for one which matches our class, then get the name
-                     */
+
+                    // TODO: We also have code registering for the names of
+                    // a tagged value like "derived"
                     LOG.error("Property '" + attribute
                              + "' for class '"
                              + metaclass.getName()
-                             + "' doesn't exist in metamodel"
-                             + " (possible false warning)");
+                             + "' doesn't exist in metamodel");
 //                  throw new IllegalArgumentException("Property '"
 //                            + attributes[i] + "' doesn't exist in metamodel");
                 }
             }
         }
     }
-    
+
     /**
      * Getter provided for the dev module to allow it to discover the
      * listeners contained by the event pump.

Modified: branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/XmiReaderImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/XmiReaderImpl.java?view=diff&rev=13363&p1=branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/XmiReaderImpl.java&p2=branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/XmiReaderImpl.java&r1=13362&r2=13363
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/XmiReaderImpl.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/XmiReaderImpl.java	2007-08-15 06:35:42-0700
@@ -185,10 +185,11 @@
 
             try {
                 String systemId = inputSource.getSystemId();
-//                if (systemId == null) {
-//                    File file = copySource(inputSource);
-//                    systemId = file.toURL().toExternalForm();
-//                }
+                if (systemId == null) {
+                    File file = copySource(inputSource);
+                    systemId = file.toURL().toExternalForm();
+                    inputSource = new InputSource(systemId);
+                }
                 newElements =
                     xmiReader.read(inputSource.getByteStream(), systemId, extent);
                 
@@ -201,10 +202,8 @@
                     resolver.clearIdMaps();
                     startTopElements = modelImpl.getFacade().getRootElements();
 
-                    File tmpFile = copySource(inputSource);
                     newElements = convertAndLoadUml13(inputSource.getSystemId(),
-                            extent, xmiReader, tmpFile);
-                    tmpFile.delete();
+                            extent, xmiReader, inputSource);
                 }
 
                 numElements = modelImpl.getFacade().getRootElements().size()
@@ -261,7 +260,7 @@
     }
 
     private Collection<RefObject> convertAndLoadUml13(String systemId,
-            RefPackage extent, XMIReader xmiReader, File file)
+            RefPackage extent, XMIReader xmiReader, InputSource input)
         throws FileNotFoundException, UmlException, IOException,
             MalformedXMIException {
         
@@ -273,13 +272,8 @@
 
         unknownElement = false;
         // InputSource xformedInput = chainedTransform(transformFiles, pIs);
-        InputSource originalInput = new InputSource(
-                new FileInputStream(file));
-        // Use the original file for the system ID
-        // so any references resolve correctly
-        originalInput.setSystemId(systemId);
         InputSource xformedInput = serialTransform(transformFiles,
-                originalInput);
+                input);
         return xmiReader.read(xformedInput.getByteStream(), xformedInput
                 .getSystemId(), extent);
     }

Modified: branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/XmiReferenceResolverImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/XmiReferenceResolverImpl.java?view=diff&rev=13363&p1=branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/XmiReferenceResolverImpl.java&p2=branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/XmiReferenceResolverImpl.java&r1=13362&r2=13363
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/XmiReferenceResolverImpl.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src/model-mdr/src/org/argouml/model/mdr/XmiReferenceResolverImpl.java	2007-08-15 06:35:42-0700
@@ -177,7 +177,7 @@
         }
         
         String key;
-        if (systemId == null) {
+        if (systemId == null || "".equals(systemId)) {
             // No # here because PGML parser needs bare UUID/xmi.id
             key = xmiId;            
         } else {

Modified: branches/gsoc2007/maurelio1234/branch2/src/model/src/org/argouml/model/Facade.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src/model/src/org/argouml/model/Facade.java?view=diff&rev=13363&p1=branches/gsoc2007/maurelio1234/branch2/src/model/src/org/argouml/model/Facade.java&p2=branches/gsoc2007/maurelio1234/branch2/src/model/src/org/argouml/model/Facade.java&r1=13362&r2=13363
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src/model/src/org/argouml/model/Facade.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src/model/src/org/argouml/model/Facade.java	2007-08-15 06:35:42-0700
@@ -76,6 +76,23 @@
     String DERIVED_TAG = "derived"; //$NON-NLS-1$
 
     ////////////////////////////////////////////////////////////////
+    
+    /**
+     * Return the version of the UML metamodel supported by the underlying
+     * implementation. The version string is made up of numerical components
+     * separated by the '.' character with the most significant digits on the
+     * left.
+     * <p>
+     * The MDR implementation supports UML 1.4 and the initial eUML
+     * implementation supports UML 2.1.1. The earlier NSUML implementation
+     * supported UML 1.3.
+     * 
+     * @return a period ('.') separated string of version numbers. e.g. "1.4" or
+     *         "2.1.1"
+     */
+    String getUmlVersion();
+    
+    ////////////////////////////////////////////////////////////////
     /**
      * Recognizer for Abstraction.
      *

Modified: branches/gsoc2007/maurelio1234/branch2/src/model/src/org/argouml/model/Model.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src/model/src/org/argouml/model/Model.java?view=diff&rev=13363&p1=branches/gsoc2007/maurelio1234/branch2/src/model/src/org/argouml/model/Model.java&p2=branches/gsoc2007/maurelio1234/branch2/src/model/src/org/argouml/model/Model.java&r1=13362&r2=13363
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src/model/src/org/argouml/model/Model.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src/model/src/org/argouml/model/Model.java	2007-08-15 06:35:42-0700
@@ -30,9 +30,9 @@
 
 /**
  * This is the root class of the Model subsystem. All other subsystems
- * can retreive the correct version of the API from this class.<p>
+ * can retrieve the correct version of the API from this class.<p>
  *
- * Notice that all API's returned from this class are to be independant
+ * Notice that all API's returned from this class are to be independent
  * of and specific UML model implementation.<p>
  *
  * For this to work the Model subsystem needs to be initialized with a

Modified: branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/kernel/ProjectImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/kernel/ProjectImpl.java?view=diff&rev=13363&p1=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/kernel/ProjectImpl.java&p2=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/kernel/ProjectImpl.java&r1=13362&r2=13363
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/kernel/ProjectImpl.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/kernel/ProjectImpl.java	2007-08-15 06:35:42-0700
@@ -368,14 +368,16 @@
      */
     protected void removeProjectMemberDiagram(ArgoDiagram d) {
         if (activeDiagram == d) {
-            ArgoDiagram defaultDiagram;
+            ArgoDiagram defaultDiagram = null;
             if (diagrams.size() == 1) {
                 // We're deleting the last diagram so lets create a new one
                 // TODO: Once we go MDI we won't need this.
-                defaultDiagram =
-                    DiagramFactory.getInstance().createDefaultDiagram(
-                            getRoot());
-                addMember(defaultDiagram);
+                Object projectRoot = getRoot();
+                if (!Model.getUmlFactory().isRemoved(projectRoot)) {
+                    defaultDiagram = DiagramFactory.getInstance()
+                            .createDefaultDiagram(projectRoot);
+                    addMember(defaultDiagram);
+                }
             } else {
                 // Make the topmost diagram (that is not the one being deleted)
                 // current.

Modified: branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/kernel/ProjectSettings.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/kernel/ProjectSettings.java?view=diff&rev=13363&p1=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/kernel/ProjectSettings.java&p2=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/kernel/ProjectSettings.java&r1=13362&r2=13363
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/kernel/ProjectSettings.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/kernel/ProjectSettings.java	2007-08-15 06:35:42-0700
@@ -133,6 +133,22 @@
                 Argo.KEY_MOST_RECENT_EXPORT_DIRECTORY, generationOutputDir);
     }
 
+    /**
+     * Send all events...
+     */
+    public void init() {
+        setNotationLanguage(getNotationLanguage());
+        setShowBoldNames(getShowBoldNamesValue());
+        setUseGuillemots(getUseGuillemotsValue());
+        setShowVisibility(getShowVisibilityValue());
+        setShowMultiplicity(getShowMultiplicityValue());
+        setShowInitialValue(getShowInitialValueValue());
+        setShowProperties(getShowPropertiesValue());
+        setShowTypes(getShowTypesValue());
+        setShowStereotypes(getShowStereotypesValue());
+        setShowSingularMultiplicities(getShowSingularMultiplicitiesValue());
+        setDefaultShadowWidth(getDefaultShadowWidthValue());
+    }
 
     /**
      * Used by "argo.tee".

Modified: branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/ProjectBrowser.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/ProjectBrowser.java?view=diff&rev=13363&p1=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/ProjectBrowser.java&p2=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/ProjectBrowser.java&r1=13362&r2=13363
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/ProjectBrowser.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/ProjectBrowser.java	2007-08-15 06:35:42-0700
@@ -1663,6 +1663,7 @@
                                     project);
                             ProjectManager.getManager().removeProject(
                                     oldProject);
+                            project.getProjectSettings().init();
                         }
                     }
 

Modified: branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/cmd/CmdSetPreferredSize.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/cmd/CmdSetPreferredSize.java?view=diff&rev=13363&p1=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/cmd/CmdSetPreferredSize.java&p2=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/cmd/CmdSetPreferredSize.java&r1=13362&r2=13363
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/cmd/CmdSetPreferredSize.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/cmd/CmdSetPreferredSize.java	2007-08-15 06:35:42-0700
@@ -141,7 +141,8 @@
                     /* But exclude elements that enclose others, 
                      * since their algorithms to calculate the minimum size 
                      * does not take enclosed objects into account: */
-                    && (fi.getEnclosedFigs().size() == 0)) {
+                    && (fi.getEnclosedFigs() == null 
+                            || fi.getEnclosedFigs().size() == 0)) {
                 if (mode == PREFERRED_SIZE) {
                     fi.setSize(fi.getPreferredSize());
                 } else {

Modified: branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/targetmanager/TargetManager.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/targetmanager/TargetManager.java?view=diff&rev=13363&p1=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/targetmanager/TargetManager.java&p2=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/targetmanager/TargetManager.java&r1=13362&r2=13363
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/targetmanager/TargetManager.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/targetmanager/TargetManager.java	2007-08-15 06:35:42-0700
@@ -581,6 +581,10 @@
      * @param target the target to be added.
      */
     public synchronized void addTarget(Object target) {
+        if (target instanceof TargetListener) {
+            LOG.warn("addTarget method received a TargetListener, "
+                    + "perhaps addTargetListener was intended! - " + target);
+        }
 	if (isInTargetTransaction()) {
             return;
         }

Modified: branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/diagram/ui/FigAssociationClass.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/diagram/ui/FigAssociationClass.java?view=diff&rev=13363&p1=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/diagram/ui/FigAssociationClass.java&p2=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/diagram/ui/FigAssociationClass.java&r1=13362&r2=13363
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/diagram/ui/FigAssociationClass.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/diagram/ui/FigAssociationClass.java	2007-08-15 06:35:42-0700
@@ -94,10 +94,11 @@
     }
 
     /**
-     * Discover the attached FigEdgeAssociationClass and the
-     * FigClassAssociationClass attached to that. Remove them from the diagram
-     * before removing this.
+     * Remove entire composite Fig from Diagram. Discover the attached
+     * FigEdgeAssociationClass and the FigClassAssociationClass attached to
+     * that. Remove them from the diagram before removing this.
      */
+    @Override
     protected void removeFromDiagramImpl() {
         FigEdgeAssociationClass figEdgeLink = null;
         List edges = null;
@@ -130,10 +131,12 @@
     }
 
     /*
+     * TODO: Is this required? Why would the fig already be dashed?
+     * 
      * @see org.tigris.gef.presentation.FigEdge#setFig(
-     *      org.tigris.gef.presentation.Fig) TODO: Is this required? Why would
-     *      the fig already be dashed?
+     *      org.tigris.gef.presentation.Fig)
      */
+    @Override
     public void setFig(Fig f) {
         super.setFig(f);
         getFig().setDashed(false);
@@ -142,12 +145,15 @@
     /*
      * @see org.argouml.uml.diagram.ui.FigEdgeModelElement#getNameFig()
      */
+    @Override
     protected FigText getNameFig() {
         return null;
     }
 
     /**
-     * Overrided in order to implement AttributesCompartmentContainer.
+     * @return the bounds of the operations compartment for the associated
+     *         FigClassAssociationClass.
+     * @see org.argouml.uml.diagram.AttributesCompartmentContainer#getAttributesBounds()
      */
     public Rectangle getAttributesBounds() {
         if (getAssociationClass() != null)
@@ -170,8 +176,9 @@
      * Overrided in order to implement AttributesCompartmentContainer.
      */
     public void setAttributesVisible(boolean visible) {
-        getAssociationClass().setAttributesVisible(visible);
-
+        if (getAssociationClass() != null) {
+            getAssociationClass().setAttributesVisible(visible);
+        }
     }
 
     /**
@@ -188,34 +195,40 @@
      * Overrided in order to implement PathCompartmentContainer.
      */
     public void setPathVisible(boolean visible) {
-        getAssociationClass().setPathVisible(visible);
+        if (getAssociationClass() != null) {
+            getAssociationClass().setPathVisible(visible);
+        }
     }
 
     /**
      * Overrided in order to implement OperationsCompartmentContainer.
      */
     public Rectangle getOperationsBounds() {
-        if (getAssociationClass() != null)
+        if (getAssociationClass() != null) {
             return getAssociationClass().getOperationsBounds();
-        else
+        } else {
             return new Rectangle(0, 0, 0, 0);
+        }
     }
 
     /**
      * Overrided in order to implement OperationsCompartmentContainer.
      */
     public boolean isOperationsVisible() {
-        if (getAssociationClass() != null)
+        if (getAssociationClass() != null) {
             return getAssociationClass().isOperationsVisible();
-        else
+        } else {
             return true;
+        }
     }
 
     /**
      * Overrided in order to implement OperationsCompartmentContainer.
      */
     public void setOperationsVisible(boolean visible) {
-        getAssociationClass().setOperationsVisible(visible);
+        if (getAssociationClass() != null) {
+            getAssociationClass().setOperationsVisible(visible);
+        }
     }
 
     /**
@@ -224,7 +237,9 @@
      */
     @Override
     public void setFillColor(Color color) {
-        getAssociationClass().setFillColor(color);
+        if (getAssociationClass() != null) {
+            getAssociationClass().setFillColor(color);
+        }
     }
 
     /**
@@ -233,10 +248,11 @@
      */
     @Override
     public Color getFillColor() {
-        if (getAssociationClass() != null)
+        if (getAssociationClass() != null) {
             return getAssociationClass().getFillColor();
-        else
+        } else {
             return Color.white;
+        }
     }
 
     /**
@@ -318,4 +334,4 @@
 
         return figEdgeLink;
     }
-} /* end class FigAssociationClass */
+}

Modified: branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/TabProps.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/TabProps.java?view=diff&rev=13363&p1=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/TabProps.java&p2=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/TabProps.java&r1=13362&r2=13363
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/TabProps.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/TabProps.java	2007-08-15 06:35:42-0700
@@ -191,7 +191,7 @@
      */
     public TabProps(String tabName, String panelClassBase) {
         super(tabName);
-        TargetManager.getInstance().addTarget(this);
+        TargetManager.getInstance().addTargetListener(this);
         setOrientation(ConfigLoader.getTabPropsOrientation());
         panelClassBaseName = panelClassBase;
         setLayout(new BorderLayout());

Modified: branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/UMLCheckBox2.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/UMLCheckBox2.java?view=diff&rev=13363&p1=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/UMLCheckBox2.java&p2=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/UMLCheckBox2.java&r1=13362&r2=13363
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/UMLCheckBox2.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/UMLCheckBox2.java	2007-08-15 06:35:42-0700
@@ -37,13 +37,13 @@
 import org.tigris.gef.presentation.Fig;
 
 /**
- * The checkbox to be used to show boolean attributes in the GUI's. Mostly used
- * on proppanels. The other new GUI elements (like UMLLinkedList) divide the
+ * The checkbox to be used to show boolean UML attributes in the GUI's. Mostly
+ * used on proppanels. Other GUI elements (like UMLLinkedList) divide the
  * responsibility of showing an attribute and maintaining the state of the
  * attribute between a GUI element and a model. This is not the case for the
- * UMLCheckBox2. Reason for this is that the model is just to simple to allow
+ * UMLCheckBox2. Reason for this is that the model is just too simple to need
  * extra classes for the model.
- *
+ * 
  * @since Oct 12, 2002
  * @author [email protected]
  */
@@ -77,18 +77,16 @@
     }
 
     /**
-     * Returns the target. The target is directly asked from the
-     * _target attribute and not from the _container attribute to make
-     * the move to a new targeting system as easy as possible.
+     * Return the target. 
      *
-     * @return Object
+     * @return the target
      */
     public Object getTarget() {
         return checkBoxTarget;
     }
 
     /**
-     * Sets the target. This method will not be used untill the target does
+     * Sets the target. This method will not be used until the target does
      * not come via the container.
      * @param target The target to set
      */
@@ -109,7 +107,7 @@
 
     /**
      * Builds the model. That is: it sets the checkbox to true or
-     * false. The name of this method is choosen to be compliant with
+     * false. The name of this method is chosen to be compliant with
      * for example UMLModelElementListModel2.
      */
     public abstract void buildModel();

Modified: branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/UMLComboBoxModel2.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/UMLComboBoxModel2.java?view=diff&rev=13363&p1=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/UMLComboBoxModel2.java&p2=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/UMLComboBoxModel2.java&r1=13362&r2=13363
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/UMLComboBoxModel2.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/UMLComboBoxModel2.java	2007-08-15 06:35:42-0700
@@ -48,9 +48,7 @@
 import org.tigris.gef.presentation.Fig;
 
 /**
- * ComboBoxmodel for UML modelelements. This implementation does not use
- * reflection and seperates Model, View and Controller better then does
- * the former UMLComboBoxModel. <p>
+ * ComboBox Model for UML modelelements. <p>
  *
  * This combobox allows selecting no value, if so indicated
  * at construction time of this class. I.e. it is "clearable".
@@ -115,8 +113,8 @@
      * @param clearable Flag to indicate if the user may select ""
      * as value in the combobox. If true the attribute that is shown
      * by this combobox may be set to null.
-     * Makes sure that there is allways a "" in the list with objects so the
-     * user has the oportunity to select this to clear the attribute.
+     * Makes sure that there is always a "" in the list with objects so the
+     * user has the opportunity to select this to clear the attribute.
      * @throws IllegalArgumentException if one of the arguments is null
      */
     public UMLComboBoxModel2(String name, boolean clearable) {
@@ -565,6 +563,7 @@
      * @see javax.swing.AbstractListModel#fireContentsChanged(
      *          Object, int, int)
      */
+    @Override
     protected void fireContentsChanged(Object source, int index0, int index1) {
         if (fireListEvents && !buildingModel) {
             super.fireContentsChanged(source, index0, index1);
@@ -575,6 +574,7 @@
      * @see javax.swing.AbstractListModel#fireIntervalAdded(
      *          Object, int, int)
      */
+    @Override
     protected void fireIntervalAdded(Object source, int index0, int index1) {
         if (fireListEvents && !buildingModel) {
             super.fireIntervalAdded(source, index0, index1);
@@ -585,6 +585,7 @@
      * @see javax.swing.AbstractListModel#fireIntervalRemoved(
      *          Object, int, int)
      */
+    @Override
     protected void fireIntervalRemoved(Object source, int index0, int index1) {
         if (fireListEvents && !buildingModel) {
             super.fireIntervalRemoved(source, index0, index1);

Modified: branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/behavior/collaborations/UMLAssociationRoleBaseComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/behavior/collaborations/UMLAssociationRoleBaseComboBoxModel.java?view=diff&rev=13363&p1=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/behavior/collaborations/UMLAssociationRoleBaseComboBoxModel.java&p2=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/behavior/collaborations/UMLAssociationRoleBaseComboBoxModel.java&r1=13362&r2=13363
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/behavior/collaborations/UMLAssociationRoleBaseComboBoxModel.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/behavior/collaborations/UMLAssociationRoleBaseComboBoxModel.java	2007-08-15 06:35:42-0700
@@ -26,7 +26,6 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Iterator;
 
 import org.argouml.model.Model;
 import org.argouml.uml.ui.UMLComboBoxModel2;
@@ -52,6 +51,7 @@
     /*
      * @see org.argouml.uml.ui.UMLComboBoxModel2#buildModelList()
      */
+    @Override
     protected void buildModelList() {
         removeAllElements();
         Object ar = getTarget();
@@ -60,17 +60,22 @@
             setElements(
                     Model.getCollaborationsHelper().getAllPossibleBases(ar));
         }
-        if (base != null) addElement(base);
+        if (base != null) {
+            addElement(base);
+        }
     }
 
     /*
      * @see org.argouml.uml.ui.UMLComboBoxModel2#getSelectedModelElement()
      */
+    @Override
     protected Object getSelectedModelElement() {
         Object ar = getTarget();
         if (Model.getFacade().isAAssociationRole(ar)) {
             Object base = Model.getFacade().getBase(ar);
-            if (base != null) return base;
+            if (base != null) {
+                return base;
+            }
         }
         return null;
     }
@@ -78,11 +83,14 @@
     /*
      * @see org.argouml.uml.ui.UMLComboBoxModel2#isValidElement(Object)
      */
+    @Override
     protected boolean isValidElement(Object element) {
         Object ar = getTarget();
         if (Model.getFacade().isAAssociationRole(ar)) {
             Object base = Model.getFacade().getBase(ar);
-            if (element == base) return true;
+            if (element == base) {
+                return true;
+            }
             Collection b = 
                 Model.getCollaborationsHelper().getAllPossibleBases(ar);
             return b.contains(element);
@@ -96,23 +104,18 @@
      * 
      * @see org.argouml.uml.ui.UMLComboBoxModel2#addOtherModelEventListeners(java.lang.Object)
      */
+    @Override
     protected void addOtherModelEventListeners(Object newTarget) {
         super.addOtherModelEventListeners(newTarget);
         Collection connections = Model.getFacade().getConnections(newTarget);
         Collection types = new ArrayList();
-        Iterator it = connections.iterator();
-        while (it.hasNext()) {
-            Object conn = it.next();
+        for (Object conn : connections) {
             types.add(Model.getFacade().getType(conn));
         }
-        it = types.iterator();
-        while (it.hasNext()) {
-            Object classifierRole = it.next();
+        for (Object classifierRole : types) {
             others.addAll(Model.getFacade().getBases(classifierRole));
         }
-        it = others.iterator();
-        while (it.hasNext()) {
-            Object classifier = it.next();
+        for (Object classifier : others) {
             Model.getPump().addModelEventListener(this, 
                     classifier, "feature");
         }
@@ -121,11 +124,10 @@
     /*
      * @see org.argouml.uml.ui.UMLComboBoxModel2#removeOtherModelEventListeners(java.lang.Object)
      */
+    @Override
     protected void removeOtherModelEventListeners(Object oldTarget) {
         super.removeOtherModelEventListeners(oldTarget);
-        Iterator i = others.iterator();
-        while (i.hasNext()) {
-            Object classifier = i.next();
+        for (Object classifier : others) {
             Model.getPump().removeModelEventListener(this, 
                     classifier, "feature");
         }

Modified: branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/foundation/core/UMLClassifierAssociationEndListModel.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/foundation/core/UMLClassifierAssociationEndListModel.java?view=diff&rev=13363&p1=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/foundation/core/UMLClassifierAssociationEndListModel.java&p2=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/foundation/core/UMLClassifierAssociationEndListModel.java&r1=13362&r2=13363
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/foundation/core/UMLClassifierAssociationEndListModel.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/foundation/core/UMLClassifierAssociationEndListModel.java	2007-08-15 06:35:42-0700
@@ -39,7 +39,7 @@
      * Constructor for UMLClassifierAssociationEndListModel.
      */
     public UMLClassifierAssociationEndListModel() {
-        super("associationEnd", Model.getMetaTypes().getAssociation());
+        super("association", Model.getMetaTypes().getAssociation());
     }
 
     /*

Modified: branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLMetaClassComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLMetaClassComboBoxModel.java?view=diff&rev=13363&p1=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLMetaClassComboBoxModel.java&p2=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLMetaClassComboBoxModel.java&r1=13362&r2=13363
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLMetaClassComboBoxModel.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLMetaClassComboBoxModel.java	2007-08-15 06:35:42-0700
@@ -26,7 +26,10 @@
 package org.argouml.uml.ui.foundation.extension_mechanisms;
 
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
 
 import org.argouml.model.Model;
 import org.argouml.uml.ui.UMLComboBoxModel2;
@@ -42,16 +45,27 @@
  */
 public class UMLMetaClassComboBoxModel extends UMLComboBoxModel2 {
 
-    private Collection metaClasses = 
-            Model.getCoreHelper().getAllMetatypeNames();
+    private List<String> metaClasses;
 
     /**
      * Constructor.
      */
     public UMLMetaClassComboBoxModel() {
         super("baseClass", true);
-        //TODO: You can not sort a HashSet !!!
-//        Collections.sort((List) metaClasses);
+        Collection<String> tmpMetaClasses = Model.getCoreHelper().getAllMetatypeNames();
+        
+        if (tmpMetaClasses instanceof List) {
+            metaClasses = (List<String>) tmpMetaClasses;
+        } else {
+            metaClasses = new LinkedList<String>(tmpMetaClasses);
+        }
+        try {
+            Collections.sort(metaClasses);
+        } catch (UnsupportedOperationException e) {
+            // We got passed an unmodifiable List.  Copy it and sort the result
+            metaClasses = new LinkedList<String>(tmpMetaClasses);
+            Collections.sort(metaClasses);
+        }
     }
 
     /*

Modified: branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLStereotypeTagDefinitionListModel.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLStereotypeTagDefinitionListModel.java?view=diff&rev=13363&p1=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLStereotypeTagDefinitionListModel.java&p2=branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLStereotypeTagDefinitionListModel.java&r1=13362&r2=13363
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLStereotypeTagDefinitionListModel.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLStereotypeTagDefinitionListModel.java	2007-08-15 06:35:42-0700
@@ -40,7 +40,7 @@
      * Constructor for UMLStereotypeTagDefinitionListModel.
      */
     public UMLStereotypeTagDefinitionListModel() {
-        super("dataValue");
+        super("definedTag");
         // TODO: Add referenceValue for tagged values 
         // which have a non-primitive type
     }

Modified: branches/gsoc2007/maurelio1234/branch2/tests/org/argouml/persistence/TestZargoFilePersister.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2007/maurelio1234/branch2/tests/org/argouml/persistence/TestZargoFilePersister.java?view=diff&rev=13363&p1=branches/gsoc2007/maurelio1234/branch2/tests/org/argouml/persistence/TestZargoFilePersister.java&p2=branches/gsoc2007/maurelio1234/branch2/tests/org/argouml/persistence/TestZargoFilePersister.java&r1=13362&r2=13363
==============================================================================
--- branches/gsoc2007/maurelio1234/branch2/tests/org/argouml/persistence/TestZargoFilePersister.java	(original)
+++ branches/gsoc2007/maurelio1234/branch2/tests/org/argouml/persistence/TestZargoFilePersister.java	2007-08-15 06:35:42-0700
@@ -26,16 +26,22 @@
 
 import java.io.File;
 import java.net.URL;
+import java.util.Collection;
 
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 
 import org.argouml.kernel.Project;
+import org.argouml.model.Facade;
 import org.argouml.model.InitializeModel;
+import org.argouml.model.Model;
 import org.argouml.notation.InitNotation;
 import org.argouml.notation.providers.java.InitNotationJava;
 import org.argouml.notation.providers.uml.InitNotationUml;
+import org.argouml.uml.Profile;
+import org.argouml.uml.ProfileException;
+import org.argouml.uml.ProfileJava;
 
 /**
  * Testcase to load projects without exception.
@@ -100,7 +106,7 @@
      *
      * @throws Exception when e.g. the file is not found
      */
-    public void testDoLoad1() throws Exception {
+    public void testDoLoadEmptyUml13() throws Exception {
         doLoad("/testmodels/uml13/Empty.zargo");
     }
 
@@ -109,7 +115,7 @@
      *
      * @throws Exception when e.g. the file is not found
      */
-    public void testDoLoad1a() throws Exception {
+    public void testDoLoadEmptyUml14() throws Exception {
         doLoad("/testmodels/uml14/EmptyProject024.zargo");
     }
 
@@ -118,7 +124,7 @@
      *
      * @throws Exception when e.g. the file is not found
      */
-    public void testDoLoad2() throws Exception {
+    public void testDoLoadUml13() throws Exception {
         doLoad("/testmodels/uml13/Alittlebitofeverything.zargo");
     }
 
@@ -127,7 +133,7 @@
      *
      * @throws Exception when e.g. the file is not found
      */
-    public void testDoLoad2a() throws Exception {
+    public void testDoLoadUml14() throws Exception {
         doLoad("/testmodels/uml14/Alittlebitofeverything.zargo");
     }
 
@@ -138,7 +144,7 @@
      * @throws Exception when e.g. the file is not found
      */
     public void testSave() throws Exception {
-        Project p = doLoad("/testmodels/uml13/Alittlebitofeverything.zargo");
+        Project p = doLoad("/testmodels/uml14/Alittlebitofeverything.zargo");
         ZargoFilePersister persister = new ZargoFilePersister();
         persister.save(p, new File("Alittlebitofeverything2.zargo"));
     }
@@ -164,6 +170,39 @@
         }
         assertTrue("No exception was thrown.", !loaded);
     }
+    
+    /**
+     * Test loading a project which contains external links to a profile.
+     * 
+     * @throws OpenException
+     * @throws InterruptedException
+     * @throws ProfileException 
+     */
+    public void testLoadLinkedProfile() throws OpenException,
+            InterruptedException, ProfileException {
+        // Make sure our profile is loaded
+        Profile profile = new ProfileJava();
+        Collection profileModel = profile.getProfilePackages();
+        
+        // Load a project which contains links to it
+        Project p = doLoad("/testmodels/uml14/LinkedProfile.zargo");
+        
+        // Make sure the contents match what we expect
+        final Facade f = Model.getFacade();
+        Collection topElements = f.getRootElements();
+        assertFalse("No top level elements", topElements.isEmpty());
+        for (Object element : topElements) {
+            if (f.isAClass(element)) {
+                assertEquals("Bad Name", 
+                        "HugeDecimal", 
+                        f.getNamespace(element));
+                Collection generalizations = f.getGeneralizations(element);
+                Object generalization = generalizations.iterator().next();
+                Object parent = f.getGeneral(generalization);
+                assertEquals("superclass has wrong name", "BigDecimal", f.getName(parent));
+                }
+        }
+    }
 }
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.