コード例 #1
0
  @Override
  public void refreshVisuals() {
    AbstractGraphicalEditPart parent = (AbstractGraphicalEditPart) getParent();
    parent.setLayoutConstraint(
        this, getFigure(), new Rectangle(getGraphics().getObjectConstraint(getModel())));

    String name =
        getGraphics()
            .getTextProvider()
            .getText(getModel(), CorePackage.eINSTANCE.getAbstractModelElement_Name());
    name = name == null || name.equals("null") ? "" : name;
    if (simuationAssignedLeafs == null || simuationAssignedLeafs.isEmpty()) {
      getFigure().getLabel(null).setText(name);
      getFigure().setBackgroundColor(ColorConstants.orange);
      getFigure().setForegroundColor(ColorConstants.black);
    } else {
      getFigure().setBackgroundColor(ColorConstants.blue);
      getFigure().setForegroundColor(ColorConstants.white);
      StringBuffer txt = new StringBuffer();
      txt.append(name + "\n");
      for (DataLeaf l : simuationAssignedLeafs) {
        String lname = l.getName() != null ? l.getName() : (l.getId() != null ? l.getId() : "<?>");
        txt.append(lname + "\n");
      }
      getFigure().getLabel(null).setText(txt.toString());
    }

    if (getViewer() != null && getViewer().getControl() != null) getViewer().getControl().redraw();
  }