/** 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;
 }
 /**
  * Return all interfaces the given class realizes.
  *
  * @param clazz
  * @return Collection
  */
 public Collection getRealizedInterfaces(MClassifier clazz) {
   if (clazz == null) return new ArrayList();
   Iterator it = clazz.getClientDependencies().iterator();
   List list = new ArrayList();
   MNamespace model = ProjectBrowser.TheInstance.getProject().getModel();
   while (it.hasNext()) {
     Object o = it.next();
     if (o instanceof MAbstraction) {
       MAbstraction abstraction = (MAbstraction) o;
       MStereotype stereo = abstraction.getStereotype();
       if (stereo != null
           && stereo.getBaseClass() != null
           && stereo.getName() != null
           && stereo.getBaseClass().equals("Abstraction")
           && stereo.getName().equals("realize")) {
         Iterator it2 = abstraction.getSuppliers().iterator();
         while (it2.hasNext()) {
           Object o2 = it2.next();
           if (o2 instanceof MInterface) {
             list.add(o2);
           }
         }
       }
     }
   }
   return list;
 }
 /**
  * Build a returnparameter. Removes all current return parameters from the operation and adds the
  * supplied parameter. The directionkind of the parameter will be return. The name will be equal
  * to the name of the last found return parameter or the default value "return" if no return
  * parameter was present in the operation.
  *
  * @param operation
  * @param newReturnParameter
  */
 public void setReturnParameter(MOperation operation, MParameter newReturnParameter) {
   Iterator params = operation.getParameters().iterator();
   String name = "return";
   while (params.hasNext()) {
     MParameter parameter = (MParameter) params.next();
     if ((parameter.getKind()).equals(MParameterDirectionKind.RETURN)) {
       operation.removeParameter(parameter);
       if (parameter.getName() != null || parameter.getName() == "") {
         name = parameter.getName();
       }
     }
   }
   newReturnParameter.setName(name);
   newReturnParameter.setKind(MParameterDirectionKind.RETURN);
   operation.addParameter(0, newReturnParameter);
   // we set the listeners to the figs here too
   // it would be better to do that in the figs themselves
   Project p = ProjectBrowser.TheInstance.getProject();
   Iterator it = p.findFigsForMember(operation).iterator();
   while (it.hasNext()) {
     MElementListener listener = (MElementListener) it.next();
     // UmlModelEventPump.getPump().removeModelEventListener(listener, newReturnParameter);
     UmlModelEventPump.getPump().addModelEventListener(listener, newReturnParameter);
   }
 }
 public FigDependency() {
   addPathItem(_stereo, new PathConvPercent(this, 50, 10));
   endArrow = new ArrowHeadGreater();
   endArrow.setFillColor(Color.red);
   setDestArrowHead(endArrow);
   setBetweenNearestPoints(true);
   setLayer(ProjectBrowser.TheInstance.getActiveDiagram().getLayer());
 }
 /**
  * Deletes the association end. If the associationend's owner (the association) has one
  * associationend left after this delete, it is also deleted.
  */
 public void removeElement() {
   MAssociationEnd end = (MAssociationEnd) getTarget();
   MAssociation assoc = end.getAssociation();
   Collection ends = assoc.getConnections();
   if (ends.size() > 2) {
     Iterator it =
         ProjectBrowser.TheInstance.getProject()
             .findFigsForMember(end.getAssociation())
             .iterator();
     while (it.hasNext()) {
       // should do here something if the association end is shown
     }
     UmlFactory.getFactory().delete(end);
     navigateTo(assoc);
   } else {
     ProjectBrowser.TheInstance.setDetailsTarget(assoc);
     ActionRemoveFromModel.SINGLETON.actionPerformed(new ActionEvent(this, 0, null));
   }
 }
  public static JMenu getJMenu() {
    JMenu menu = new JMenu("copy to DeploymentDiagram as ComponentInstance");
    Project p = ProjectBrowser.TheInstance.getProject();
    for (Iterator it = p.getDiagrams().iterator(); it.hasNext(); ) {
      Object d = it.next();
      if (d instanceof UMLDeploymentDiagram) menu.add(new CopyAction((UMLDeploymentDiagram) d));
    }

    return menu;
  }
 /**
  * Returns all possible namespaces that may be selected by some given modelelement m. Which
  * namespaces are allowed, is decided in the method isValidNamespace.
  *
  * @param m
  * @return Collection
  */
 public Collection getAllPossibleNamespaces(MModelElement m) {
   List ret = new ArrayList();
   if (m == null) return ret;
   MNamespace model = ProjectBrowser.TheInstance.getProject().getModel();
   if (isValidNamespace(m, model)) ret.add(model);
   Iterator it =
       ModelManagementHelper.getHelper()
           .getAllModelElementsOfKind(model, MNamespace.class)
           .iterator();
   while (it.hasNext()) {
     MNamespace ns = (MNamespace) it.next();
     if (isValidNamespace(m, ns)) ret.add(ns);
   }
   return ret;
 }
 /**
  * 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;
 }
 /**
  * Returns all classifiers found in the projectbrowser model
  *
  * @return Collection
  */
 public Collection getAllClassifiers() {
   MNamespace model = ProjectBrowser.TheInstance.getProject().getModel();
   return getAllClassifiers(model);
 }
 /**
  * Returns all behavioralfeatures found in the projectbrowser model
  *
  * @return Collection
  */
 public Collection getAllBehavioralFeatures() {
   MNamespace model = ProjectBrowser.TheInstance.getProject().getModel();
   return getAllBehavioralFeatures(model);
 }