Package org.objectstyle.wolips.eomodeler.core.model

Examples of org.objectstyle.wolips.eomodeler.core.model.EORelationship


    if (ComparisonUtils.equals(selection, getSelection())) {
      return;
    }
   
    super.setInput(part, selection);
    EORelationship relationship = null;
    Object selectedObject = ((IStructuredSelection) selection).getFirstElement();
    if (selectedObject instanceof EORelationship) {
      relationship = (EORelationship) selectedObject;
    } else if (selectedObject instanceof EORelationshipPath) {
      relationship = ((EORelationshipPath) selectedObject).getChildRelationship();
View Full Code Here


        ErrorUtils.openErrorDialog(Display.getDefault().getActiveShell(), e);
      }
    }

    protected void doubleSelectionOccurred(ISelection _selection) {
      EORelationship relationship = (EORelationship) ((IStructuredSelection) _selection).getFirstElement();
      EOModelObject jumpToModelObject = null;
      EORelationship inverseRelationship = relationship.getInverseRelationship();
      if (inverseRelationship != null) {
        jumpToModelObject = inverseRelationship;
      } else {
        EOEntity destination = relationship.getDestination();
        jumpToModelObject = destination;
View Full Code Here

  public EORelationshipsViewerSorter(String tableName) {
    super(tableName);
  }

  public Object getComparisonValue(Object _obj, String _property) {
    EORelationship relationship = (EORelationship) _obj;
    Object value = null;
    if (EORelationship.DESTINATION.equals(_property)) {
      EOEntity destination = relationship.getDestination();
      if (destination != null) {
        value = destination.getName();
      }
    } else if (EOJoin.SOURCE_ATTRIBUTE.equals(_property)) {
      EOJoin firstJoin = relationship.getFirstJoin();
      if (firstJoin != null) {
        value = firstJoin.getSourceAttribute().getName();
      }
    } else if (EOJoin.DESTINATION_ATTRIBUTE.equals(_property)) {
      EOJoin firstJoin = relationship.getFirstJoin();
      if (firstJoin != null) {
        value = firstJoin.getDestinationAttribute().getName();
      }
    } else {
      value = super.getComparisonValue(_obj, _property);
View Full Code Here

    super(tableName);
    _tableViewer = tableViewer;
  }

  public Image getColumnImage(Object element, String property) {
    EORelationship relationship = (EORelationship) element;
    Image image = null;
    if (EORelationship.TO_MANY.equals(property)) {
      image = yesNoImage(relationship.isToMany(), Activator.getDefault().getImageRegistry().get(Activator.TO_MANY_ICON), Activator.getDefault().getImageRegistry().get(Activator.TO_ONE_ICON), Activator.getDefault().getImageRegistry().get(Activator.TO_ONE_ICON));
    } else if (EORelationship.CLASS_PROPERTY.equals(property)) {
      image = yesNoImage(relationship.isClassProperty(), Activator.getDefault().getImageRegistry().get(Activator.CLASS_PROPERTY_ICON), null, null);
    } else if (EORelationship.OPTIONAL.equals(property)) {
      image = yesNoImage(relationship.isOptional(), Activator.getDefault().getImageRegistry().get(Activator.ALLOW_NULL_ICON), null, null);
    }
    return image;
  }
View Full Code Here

      text = entity.getName();
    } else if (_element instanceof EOAttribute) {
      EOAttribute attribute = (EOAttribute) _element;
      text = attribute.getName();
    } else if (_element instanceof EORelationship) {
      EORelationship relationship = (EORelationship) _element;
      text = relationship.getName();
    } else if (_element instanceof EORelationshipPath) {
      EORelationshipPath relationshipPath = (EORelationshipPath) _element;
      text = relationshipPath.getChildRelationship().getName();
    } else if (_element instanceof EOAttributePath) {
      EOAttributePath attributePath = (EOAttributePath) _element;
View Full Code Here

    }
    return image;
  }

  public String getColumnText(Object element, String property) {
    EORelationship relationship = (EORelationship) element;
    String text = null;
    if (EORelationship.TO_MANY.equals(property)) {
      // DO NOTHING
    } else if (EORelationship.CLASS_PROPERTY.equals(property)) {
      // DO NOTHING
    } else if (EORelationship.OPTIONAL.equals(property)) {
      // DO NOTHING
    } else if (EORelationship.DESTINATION.equals(property)) {
      EOEntity destination = relationship.getDestination();
      if (destination != null) {
        text = destination.getName();
      }
    } else if (EOJoin.SOURCE_ATTRIBUTE.equals(property)) {
      EOJoin firstJoin = relationship.getFirstJoin();
      if (firstJoin != null) {
        EOAttribute sourceAttribute = firstJoin.getSourceAttribute();
        if (sourceAttribute != null) {
          text = sourceAttribute.getName();
        }
      }
    } else if (EOJoin.DESTINATION_ATTRIBUTE.equals(property)) {
      EOJoin firstJoin = relationship.getFirstJoin();
      if (firstJoin != null) {
        EOAttribute destinationAttribute = firstJoin.getDestinationAttribute();
        if (destinationAttribute != null) {
          text = destinationAttribute.getName();
        }
View Full Code Here

    }
    return text;
  }

  public Font getFont(Object element, int columnIndex) {
    EORelationship relationship = (EORelationship) element;
    Font font = null;
    boolean inherited = relationship.isInherited();
    boolean flattened = relationship.isFlattened();
    if (flattened && inherited) {
      if (_flattenedInheritedFont == null) {
        Font originalFont = _tableViewer.getTable().getFont();
        FontData[] fontData = _tableViewer.getTable().getFont().getFontData();
        _flattenedInheritedFont = new Font(originalFont.getDevice(), fontData[0].getName(), fontData[0].getHeight(), SWT.BOLD | SWT.ITALIC);
View Full Code Here

    // EORelationship relationship = (EORelationship) element;
    return null;
  }

  public Color getForeground(Object element, int columnIndex) {
    EORelationship relationship = (EORelationship) element;
    Color color = null;
    boolean isClassProperty = relationship.isClassProperty() != null && relationship.isClassProperty().booleanValue();
    if (!isClassProperty) {
      color = Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GRAY);
    }
    return color;
  }
View Full Code Here

      if (_showAttributes && _showRelationships) {
        entityChildren.addAll(entity.getChildrenEntities());
      }
      children = entityChildren.toArray();
    } else if (_parentElement instanceof EORelationship) {
      EORelationship relationship = (EORelationship) _parentElement;
      Set<AbstractEOAttributePath> relationshipPathChildren = new TreeSet<AbstractEOAttributePath>(new EOSortableEOModelObjectComparator());
      relationshipPathChildren.addAll(Arrays.asList(new EORelationshipPath(null, relationship).getChildren()));
      children = relationshipPathChildren.toArray();
    } else if (_parentElement instanceof EORelationshipPath) {
      EORelationshipPath relationshipPath = (EORelationshipPath) _parentElement;
View Full Code Here

            EOAttribute selectedAttribute = (EOAttribute) selectedObject;
            setSelectedEntity(selectedAttribute.getEntity());
            getEntityEditor().setSelection(_selection);
            setActivePage(getPageNum(EOModelEditor.EOENTITY_PAGE));
          } else if (selectedObject instanceof EORelationship) {
            EORelationship selectedRelationship = (EORelationship) selectedObject;
            setSelectedEntity(selectedRelationship.getEntity());
            getEntityEditor().setSelection(selection);
            setActivePage(getPageNum(EOModelEditor.EOENTITY_PAGE));
          } else if (selectedObject instanceof EOFetchSpecification) {
            EOFetchSpecification selectedFetchSpec = (EOFetchSpecification) selectedObject;
            setSelectedEntity(selectedFetchSpec.getEntity());
View Full Code Here

TOP

Related Classes of org.objectstyle.wolips.eomodeler.core.model.EORelationship

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.