/**
   * @see
   *     org.topcased.modeler.edit.policies.AbstractEdgeCreationEditPolicy#checkTargetForSource(org.topcased.modeler.di.model.GraphElement,
   *     org.topcased.modeler.di.model.GraphElement)
   * @generated
   */
  protected boolean checkTargetForSource(GraphElement source, GraphElement target) {
    EObject sourceObject = Utils.getElement(source);
    EObject targetObject = Utils.getElement(target);

    if (sourceObject instanceof com.bluexml.side.portal.Portlet
        && targetObject instanceof com.bluexml.side.portal.PortletInternal) {
      if (!sourceObject.equals(targetObject)) {
        return true;
      }
    }
    return false;
  }
  /**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @see
   *     org.topcased.modeler.edit.policies.AbstractEdgeCreationEditPolicy#checkTargetForSource(org.topcased.modeler.di.model.GraphElement,
   *     org.topcased.modeler.di.model.GraphElement)
   * @generated
   */
  protected boolean checkTargetForSource(GraphElement source, GraphElement target) {
    EObject sourceObject = Utils.getElement(source);
    EObject targetObject = Utils.getElement(target);

    if (sourceObject instanceof org.eclipse.uml2.uml.Classifier
        && targetObject instanceof org.eclipse.uml2.uml.Component) {
      if (!sourceObject.equals(targetObject)) {
        return true;
      }
    }
    return false;
  }
Example #3
0
  /**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * Update the targetCount Label
   *
   * @generated NOT
   */
  private void updateTargetCountLabel() {
    Label targetCount = (Label) ((AssociationFigure) getFigure()).gettargetCountEdgeObjectFigure();

    Association association = (Association) Utils.getElement(getGraphEdge());
    if (association != null) {

      String lowerBound = association.getSecondEnd().getCardMin();
      String upperBound = association.getSecondEnd().getCardMax();

      if (upperBound == null) {
        upperBound = new String("0");
      }

      if (lowerBound == null) {
        lowerBound = new String("0");
      }

      if (upperBound.equals("-1")) {
        upperBound = "*";
      }

      if (lowerBound.equals(upperBound)) {
        if (!(lowerBound.equals("1"))) targetCount.setText(lowerBound);
        else targetCount.setText("");
      } else {
        targetCount.setText(lowerBound + ".." + upperBound);
      }
    }
  }
 /**
  * @see
  *     org.topcased.modeler.edit.policies.AbstractEdgeCreationEditPolicy#checkSource(org.topcased.modeler.di.model.GraphElement)
  * @generated
  */
 protected boolean checkSource(GraphElement source) {
   EObject object = Utils.getElement(source);
   if (object instanceof com.bluexml.side.portal.Portlet) {
     return true;
   }
   return false;
 }
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @see
  *     org.topcased.modeler.edit.policies.AbstractEdgeCreationEditPolicy#checkSource(org.topcased.modeler.di.model.GraphElement)
  * @generated
  */
 protected boolean checkSource(GraphElement source) {
   EObject object = Utils.getElement(source);
   if (object instanceof org.eclipse.uml2.uml.Classifier) {
     return true;
   }
   return false;
 }
Example #6
0
  /**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * Update the targetName Label
   *
   * @generated NOT
   */
  private void updateTargetNameLabel() {
    Label targetName = (Label) ((AssociationFigure) getFigure()).gettargetNameEdgeObjectFigure();

    Association association = (Association) Utils.getElement(getGraphEdge());

    targetName.setText(association.getSecondEnd().getName());
  }
Example #7
0
 /**
  * @see org.topcased.modeler.edit.GraphEdgeEditPart#getPreferenceDefaultFont()
  * @generated
  */
 protected Font getPreferenceDefaultFont() {
   String preferenceFont =
       getPreferenceStore().getString(CdDiagramPreferenceConstants.ASSOCIATION_EDGE_DEFAULT_FONT);
   if (preferenceFont.length() != 0) {
     return Utils.getFont(new FontData(preferenceFont));
   }
   return null;
 }
Example #8
0
  /**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * Update the middleName Label
   *
   * @generated NOT
   */
  private void updateMiddleNameLabel() {
    Association association = (Association) Utils.getElement(getGraphEdge());

    AssociationFigure fig = ((AssociationFigure) getFigure());
    EdgeObjectOffsetEditableLabel label =
        (EdgeObjectOffsetEditableLabel) fig.getmiddleNameEdgeObjectFigure();
    label.setText(association.getName());
  }
Example #9
0
 /**
  * @see org.topcased.modeler.edit.GraphEdgeEditPart#getPreferenceDefaultForegroundColor()
  * @generated
  */
 protected Color getPreferenceDefaultForegroundColor() {
   String preferenceForeground =
       getPreferenceStore()
           .getString(CdDiagramPreferenceConstants.ASSOCIATION_EDGE_DEFAULT_FOREGROUND_COLOR);
   if (preferenceForeground.length() != 0) {
     return Utils.getColor(preferenceForeground);
   }
   return null;
 }
  /**
   * @see
   *     org.topcased.modeler.edit.policies.AbstractEdgeCreationEditPolicy#getSourceTargetData(org.topcased.modeler.di.model.GraphElement,
   *     org.topcased.modeler.di.model.GraphElement)
   * @generated
   */
  protected SourceTargetData getSourceTargetData(GraphElement source, GraphElement target) {
    EObject sourceObject = Utils.getElement(source);
    EObject targetObject = Utils.getElement(target);

    if (sourceObject instanceof com.bluexml.side.portal.Portlet
        && targetObject instanceof com.bluexml.side.portal.PortletInternal) {
      return new SourceTargetData(
          false,
          false,
          SourceTargetData.NONE,
          null,
          null,
          null,
          null,
          null,
          "isPortletInternal",
          null,
          null);
    }
    return null;
  }
  /**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @see
   *     org.topcased.modeler.edit.policies.AbstractEdgeCreationEditPolicy#getSourceTargetData(org.topcased.modeler.di.model.GraphElement,
   *     org.topcased.modeler.di.model.GraphElement)
   * @generated
   */
  protected SourceTargetData getSourceTargetData(GraphElement source, GraphElement target) {
    EObject sourceObject = Utils.getElement(source);
    EObject targetObject = Utils.getElement(target);

    if (sourceObject instanceof org.eclipse.uml2.uml.Classifier
        && targetObject instanceof org.eclipse.uml2.uml.Component) {
      return new SourceTargetData(
          false,
          false,
          SourceTargetData.TARGET,
          "org.eclipse.uml2.uml.Classifier",
          "realization",
          "realizingClassifier",
          null,
          null,
          null,
          null,
          null);
    }
    return null;
  }
Example #12
0
  /**
   * @see org.eclipse.gef.EditPartFactory#createEditPart(org.eclipse.gef.EditPart,java.lang.Object)
   * @generated
   */
  public EditPart createEditPart(EditPart context, Object model) {
    if (model instanceof Diagram) {
      return new ReqDiagramEditPart((Diagram) model);
    } else if (model instanceof GraphNode) {
      final GraphNode node = (GraphNode) model;
      EObject element = Utils.getElement(node);
      if (element != null) {
        if ("http://www.kerblue.org/requirements/1.0"
            .equals(element.eClass().getEPackage().getNsURI())) {
          return (EditPart) new NodeRequirementsSwitch(node).doSwitch(element);
        }
      }

      if (node.getSemanticModel() instanceof SimpleSemanticModelElement) {
        // Manage the Element that are not associated with a model object
      }
    } else if (model instanceof GraphEdge) {
      final GraphEdge edge = (GraphEdge) model;
      EObject element = Utils.getElement(edge);
      if (element != null) {
        if ("http://www.kerblue.org/requirements/1.0"
            .equals(element.eClass().getEPackage().getNsURI())) {
          return (EditPart) new EdgeRequirementsSwitch(edge).doSwitch(element);
        }
      }

      if (edge.getSemanticModel() instanceof SimpleSemanticModelElement) {
        // Manage the Element that are not associated with a model object
        if (ReqSimpleObjectConstants.SIMPLE_OBJECT_IS_RESPONSIBLE.equals(
            ((SimpleSemanticModelElement) edge.getSemanticModel()).getTypeInfo())) {
          return new is_responsibleEditPart(edge);
        }
        if (ReqSimpleObjectConstants.SIMPLE_OBJECT_IS_SUB_GOAL.equals(
            ((SimpleSemanticModelElement) edge.getSemanticModel()).getTypeInfo())) {
          return new is_sub_goalEditPart(edge);
        }
      }
    }
    return super.createEditPart(context, model);
  }
Example #13
0
  /**
   * Handle the double-click to edit the association
   *
   * @see org.eclipse.gef.EditPart#performRequest(org.eclipse.gef.Request)
   */
  public void performRequest(Request request) {
    Association association = (Association) Utils.getElement(getGraphEdge());

    if (request.getType() == RequestConstants.REQ_OPEN) {

      AssociationEditDialog associationDlg =
          new AssociationEditDialog(association, ModelerPlugin.getActiveWorkbenchShell());
      if (associationDlg.open() == Window.OK) {
        AssociationUpdateCommand command =
            new AssociationUpdateCommand(association, associationDlg.getAssociationData());
        getViewer().getEditDomain().getCommandStack().execute(command);
        refreshEdgeObjects();
      }
    } else {
      super.performRequest(request);
    }
  }
Example #14
0
  /** Update the target decoration */
  private void updateTargetDecoration() {
    Association association = (Association) Utils.getElement(getGraphEdge());

    boolean isNavigable = false;
    if (association.getSecondEnd() != null) {
      isNavigable = association.getSecondEnd().isNavigable();
    }

    if (!isNavigable) {
      if (association.getAssociationType() == AssociationType.COMPOSITION) {
        targetDecor = createCompositionDecoration();
      } else if (association.getAssociationType() == AssociationType.AGGREGATION) {
        targetDecor = createAggregationDecoration();
      } else {
        targetDecor = null;
      }
    } else {
      targetDecor = createNavigableDecoration();
    }
    ((PolylineConnection) figure).setTargetDecoration(targetDecor);
  }
Example #15
0
  /**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated NOT
   */
  protected void refreshEdgeObjects() {
    super.refreshEdgeObjects();

    // Check whether the association has its two Properties set
    if (((GraphEdge) getModel()).getAnchor().size() != 0) {
      Association association = (Association) Utils.getElement(getGraphEdge());
      if (association.getName() == null) {
        association.setName("Association");
      }
      // create associationEnd objects
      AssociationHelper.createAssociationsEnds(this, association);
      updateSourceDecoration();
      updateTargetDecoration();
      updateSrcCountLabel();
      updateSrcNameLabel();
      updateTargetCountLabel();
      updateTargetNameLabel();
    }

    updateMiddleNameLabel();
  }
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @see
  *     org.topcased.modeler.edit.policies.AbstractEdgeCreationEditPolicy#checkEdge(org.topcased.modeler.di.model.GraphEdge)
  * @generated
  */
 protected boolean checkEdge(GraphEdge edge) {
   return Utils.getElement(edge) instanceof ComponentRealization;
 }
Example #17
0
  /**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * Update the srcName Label
   *
   * @generated NOT
   */
  private void updateSrcNameLabel() {
    Label srcName = (Label) ((AssociationFigure) getFigure()).getsrcNameEdgeObjectFigure();

    Association association = (Association) Utils.getElement(getGraphEdge());
    srcName.setText(association.getFirstEnd().getName());
  }