1 26 package org.objectweb.openccm.explorer.Components; 27 28 import org.objectweb.util.explorer.api.DropAction; 29 import org.objectweb.util.explorer.api.DropTreeView; 30 import org.omg.Components.CCMObject; 31 import org.omg.Components.FacetDescription; 32 import org.omg.Components.ReceptacleDescription; 33 34 41 public class ConnectOnDropAction 42 implements DropAction { 43 44 50 56 62 68 71 public void execute(DropTreeView dropTreeView) throws Exception { 72 if(dropTreeView!=null){ 73 Object object = dropTreeView.getDragSourceObject(); 74 75 org.omg.CORBA.Object obj_ref = null; 76 if (object instanceof org.omg.CORBA.Object ) { 77 obj_ref = (org.omg.CORBA.Object ) object; 78 } else if (object instanceof FacetDescription) { 79 obj_ref = ((FacetDescription)object).facet_ref; 80 } else { 81 throw new Exception ("CORBA object expected !"); 82 } 83 84 ReceptacleContainer rc = (ReceptacleContainer) dropTreeView.getSelectedObject(); 85 ReceptacleDescription receptacle = rc.getReceptacle(); 86 CCMObject component = rc.getComponent(); 87 if (component != null && receptacle != null && obj_ref != null) { 88 component.connect(receptacle.name, obj_ref); 89 } 90 } 91 } 92 93 } 94 | Popular Tags |