コード例 #1
0
 /** Builds a dependency with stereotype support */
 public MDependency buildSupportDependency(MModelElement from, MModelElement to) {
   MDependency dep = CoreFactory.getFactory().buildDependency(from, to);
   MNamespace model = ProjectBrowser.TheInstance.getProject().getModel();
   MStereotype stereo =
       ExtensionMechanismsFactory.getFactory()
           .buildStereotype(dep, "support", ProjectBrowser.TheInstance.getProject().getModel());
   return dep;
 }
コード例 #2
0
 /**
  * Returns the realization (abstraction) between some class and some interface
  *
  * @param source
  * @param clazz
  * @return MAbstraction
  */
 public MAbstraction getRealization(MInterface source, MClassifier clazz) {
   if (source == null || clazz == null) return null;
   Iterator it = clazz.getClientDependencies().iterator();
   MNamespace model = ProjectBrowser.TheInstance.getProject().getModel();
   MStereotype stereo =
       ExtensionMechanismsFactory.getFactory()
           .buildStereotype(new MAbstractionImpl(), "realize", model);
   while (it.hasNext()) {
     Object o = it.next();
     if (o instanceof MAbstraction && ((MAbstraction) o).getStereotype().equals(stereo)) {
       Iterator it2 = ((MAbstraction) o).getSuppliers().iterator();
       while (it2.hasNext()) {
         Object o2 = it2.next();
         if (o2.equals(source)) {
           return (MAbstraction) o;
         }
       }
     }
   }
   return null;
 }