Commits

Anonymous committed 40a5a95

two problems fixed, rules are set for associations, now associations can only be added to classes and not to instances portDicitonary in XMLFactory now keeps information about the instances as well

Comments (0)

Files changed (2)

src/nl/tudelft/lime/model/commands/connection/AssociationCommand.java

 package nl.tudelft.lime.model.commands.connection;
 
+import nl.tudelft.lime.model.component.LimeComponent;
+
 
 /**
  * This class defines when an association can be created
 public class AssociationCommand extends ConnectionCommand {
     public boolean canExecute() {
         if ((source != null) && (target != null)) {
-            return source.getClass().equals(target.getClass());
+            return source.getClass().equals(target.getClass()) && !((LimeComponent)(source.getParent())).isInstance();
         } else if ((oldSource != null) && (oldTarget != null)) {
             return oldSource.getClass().equals(oldTarget.getClass());
         } else {

src/nl/tudelft/lime/xml/XMLFactory.java

                 for (LimeElement componentElement : ((LimeComponent) myComponents).getChildren()) {
                     if (componentElement instanceof Port) {
                         Port port = (Port) componentElement;
+                        //both the port and all its instances should be put on portDictionary
+                        List<LimeSubpart> instances = port.getInstances();
+                        for (LimeSubpart instance : instances){
+                        	Port portInstance = (Port) instance;
+                            String portId = portInstance.getParent().getName() + ":" +
+                            portInstance.getName();
+                            portDictionary.put(portId, portInstance);
+                        }
+                        	
                         String portId = port.getParent().getName() + ":" +
                             port.getName();
                         portDictionary.put(portId, port);