svn commit: r15541 - trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: bobtarling
Date: 2008-08-10 16:43:46-0700
New Revision: 15541

Modified:
   trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java

Log:
Issue 4994: Don't allow a connection from a read only model element to some other

Modified: trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java?view=diff&rev=15541&p1=trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java&p2=trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java&r1=15540&r2=15541
==============================================================================
--- trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java	(original)
+++ trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java	2008-08-10 16:43:46-0700
@@ -612,6 +612,14 @@
 
     public boolean isConnectionValid(Object connectionType, Object fromElement,
             Object toElement, boolean checkWFR) {
+        if (Model.getModelManagementHelper().isReadOnly(fromElement)) {
+            // Don't allow connections to be created from a read only
+            // model element to any other
+            // TODO: Maybe we should allow association so long as both ends
+            // are not read only. We would then have to reverse the ends in
+            // buildConnection and force to unidirectional.
+            return false;
+        }
         // Get the list of valid model item pairs for the given connection type
         List<Class<?>[]> validItems = validConnectionMap.get(connectionType);
         if (validItems == null) {
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.