コード例 #1
0
  protected void modelChanged() {
    super.modelChanged();
    MComponentInstance coi = (MComponentInstance) getOwner();
    if (coi == null) return;
    String nameStr = "";
    if (coi.getName() != null) {
      nameStr = coi.getName().trim();
    }

    // construct bases string (comma separated)
    String baseStr = "";
    Collection col = coi.getClassifiers();
    if (col != null && col.size() > 0) {
      Iterator it = col.iterator();
      baseStr = ((MClassifier) it.next()).getName();
      while (it.hasNext()) {
        baseStr += ", " + ((MClassifier) it.next()).getName();
      }
    }
    if (_readyToEdit) {
      if (nameStr == "" && baseStr == "") _name.setText("");
      else _name.setText(nameStr.trim() + " : " + baseStr);
    }
    Dimension nameMin = _name.getMinimumSize();
    Rectangle r = getBounds();
    setBounds(r.x, r.y, r.width, r.height);

    updateStereotypeText();
  }
コード例 #2
0
  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;
  }