Package com.google.devtools.depan.graph.api

Examples of com.google.devtools.depan.graph.api.DirectedRelation


  public void updateTable(List<SourcePlugin> plugins) {
    relationPickerContent.clear();
    contentMap = Maps.newHashMap();
    for (SourcePlugin p : plugins) {
      for (Relation r : p.getRelations()) {
        DirectedRelation directedRelation = new BasicDirectedRelation(r);
        // add to the content provider
        relationPickerContent.add(directedRelation);
        // and to the map for fast retrieval
        contentMap.put(r, directedRelation);
      }
View Full Code Here


   * @param relation the relation
   * @param on true to select, false to unselect
   * @param notify true to notify the listeners of the changes
   */
  private void setForward(Relation relation, boolean on, boolean notify) {
    DirectedRelation directedRelation = contentMap.get(relation);
    if (null == directedRelation) {
      return;
    }
    if (on != directedRelation.matchForward()) {
      directedRelation.setMatchForward(on);
      // update the table
      relationPicker.update(directedRelation,
          new String[] {RelationshipPickerHelper.COL_FORWARD});
      if (notify) {
        // notify the listeners that this column has changed
View Full Code Here

   * @param relation the relation
   * @param on true to select, false to unselect
   * @param notify true to notify the listeners of the changes
   */
  private void setBackward(Relation relation, boolean on, boolean notify) {
    DirectedRelation directedRelation = contentMap.get(relation);
    if (null == directedRelation) {
      return;
    }
    if (on != directedRelation.matchBackward()) {
      directedRelation.setMatchBackward(on);
      // update the table
      relationPicker.update(directedRelation,
          new String[] {RelationshipPickerHelper.COL_BACKWARD});
      if (notify) {
        // notify listeners
View Full Code Here

  @Override
  public String getString(Object object) {
    if (!(object instanceof DirectedRelation)) {
      return object.toString();
    }
    DirectedRelation relation = (DirectedRelation) object;
    return relation.getRelation().toString();
  }
View Full Code Here

   * @see org.eclipse.jface.viewers.ICellModifier #getValue(java.lang.Object,
   *      java.lang.String)
   */
  public Object getValue(Object element, String property) {
    if (element instanceof DirectedRelation) {
      DirectedRelation relation = ((DirectedRelation) element);
      if (property.equals(RelationshipPickerHelper.COL_BACKWARD)) {
        return relation.matchBackward();
      } else if (property.equals(RelationshipPickerHelper.COL_FORWARD)) {
        return relation.matchForward();
      }
    }
    return null;
  }
View Full Code Here

    if (!(o instanceof DirectedRelation)) {
      return;
    }

    DirectedRelation relation = ((DirectedRelation) o);

    if (null != changeListener) {
      changeListener.modify(relation, property, (Boolean) value);
    }

    if (property.equals(RelationshipPickerHelper.COL_BACKWARD)) {
      relation.setMatchBackward((Boolean) value);
    } else if (property.equals(RelationshipPickerHelper.COL_FORWARD)) {
      relation.setMatchForward((Boolean) value);
    }

    // update the column / line we just modified
    table.update(o, new String[] {property});
  }
View Full Code Here

   * @see org.eclipse.jface.viewers.ITableLabelProvider
   *      #getColumnImage(java.lang.Object, int)
   */
  public Image getColumnImage(Object element, int columnIndex) {
    if (element instanceof DirectedRelation) {
      DirectedRelation relation = ((DirectedRelation) element);
      switch (columnIndex) {
      case 0: return null;
      case 1:
        return Resources.getOnOff(relation.matchForward());
      case 2:
        return Resources.getOnOff(relation.matchBackward());
      default:
        break;
      }
    }
    return null;
View Full Code Here

   * @see org.eclipse.jface.viewers.ITableLabelProvider
   *      #getColumnText(java.lang.Object, int)
   */
  public String getColumnText(Object element, int columnIndex) {
    if (element instanceof DirectedRelation) {
      DirectedRelation relation = ((DirectedRelation) element);
      switch (columnIndex) {
      case 0:
        return relation.getRelation().toString().toLowerCase();
      case 1:
        if (relation.matchForward()) {
          return relation.getRelation().getForwardName();
        }
        return relation.getRelation().getForwardName();
      case 2:
        if (relation.matchBackward()) {
          return relation.getRelation().getReverseName();
        }
        return relation.getRelation().getReverseName();
      default:
        break;
      }
    }
    return "";
View Full Code Here

   *      #getBackwardRelations()
   */
  public Collection<Relation> getBackwardRelations() {
    Collection<Relation> backwardRelations = new ArrayList<Relation>();
    for (Relation relation : map.keySet()) {
      DirectedRelation direction = map.get(relation);
      if (direction.matchBackward()) {
        backwardRelations.add(relation);
      }
    }
    return backwardRelations;
  }
View Full Code Here

   *      #getForwardRelations()
   */
  public Collection<Relation> getForwardRelations() {
    Collection<Relation> forwardRelations = new ArrayList<Relation>();
    for (Relation relation : map.keySet()) {
      DirectedRelation direction = map.get(relation);
      if (direction.matchForward()) {
        forwardRelations.add(relation);
      }
    }
    return forwardRelations;
  }
View Full Code Here

TOP

Related Classes of com.google.devtools.depan.graph.api.DirectedRelation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.