コード例 #1
0
  /** {@inheritDoc} */
  @Override
  protected void refreshOutlineVisuals() {
    Relation model = (Relation) this.getModel();

    ERDiagram diagram = (ERDiagram) this.getRoot().getContents().getModel();

    int viewMode = diagram.getDiagramContents().getSettings().getOutlineViewMode();

    boolean first = true;
    StringBuilder sb = new StringBuilder();

    for (NormalColumn foreignKeyColumn : model.getForeignKeyColumns()) {
      if (first) {
        first = false;
      } else {
        sb.append(", ");
      }

      if (viewMode == Settings.VIEW_MODE_PHYSICAL) {
        sb.append(Format.null2blank(foreignKeyColumn.getPhysicalName()));

      } else if (viewMode == Settings.VIEW_MODE_LOGICAL) {
        sb.append(Format.null2blank(foreignKeyColumn.getLogicalName()));

      } else {
        sb.append(Format.null2blank(foreignKeyColumn.getLogicalName()));
        sb.append("/");
        sb.append(Format.null2blank(foreignKeyColumn.getPhysicalName()));
      }
    }

    this.setWidgetText(sb.toString());
    this.setWidgetImage(Activator.getImage(ImageKey.FOREIGN_KEY));
  }
コード例 #2
0
  private List<NormalColumn> getSelectedForeignKeyColulmnList() {
    List<NormalColumn> foreignKeyColulmnList = new ArrayList<NormalColumn>();

    TableViewEditPart parent = (TableViewEditPart) this.getParent();

    for (Object object : parent.getTargetConnections()) {
      ConnectionEditPart connectionEditPart = (ConnectionEditPart) object;

      int selected = connectionEditPart.getSelected();

      if (selected == EditPart.SELECTED || selected == EditPart.SELECTED_PRIMARY) {
        ConnectionElement connectionElement = (ConnectionElement) connectionEditPart.getModel();

        if (connectionElement instanceof Relation) {
          Relation relation = (Relation) connectionElement;

          foreignKeyColulmnList.addAll(relation.getForeignKeyColumns());
        }
      }
    }

    return foreignKeyColulmnList;
  }