Пример #1
0
 /** @generated */
 public Node createNode(
     IAdaptable semanticAdapter,
     View containerView,
     String semanticHint,
     int index,
     boolean persisted,
     PreferencesHint preferencesHint) {
   final EObject domainElement = getSemanticElement(semanticAdapter);
   final int visualID;
   if (semanticHint == null) {
     visualID = RdalVisualIDRegistry.getNodeVisualID(containerView, domainElement);
   } else {
     visualID = RdalVisualIDRegistry.getVisualID(semanticHint);
   }
   switch (visualID) {
     case RequirementsGroupEditPart.VISUAL_ID:
       return createRequirementsGroup_2007(
           domainElement, containerView, index, persisted, preferencesHint);
     case StakeHolderEditPart.VISUAL_ID:
       return createStakeHolder_2011(
           domainElement, containerView, index, persisted, preferencesHint);
     case VerificationActivityEditPart.VISUAL_ID:
       return createVerificationActivity_2010(
           domainElement, containerView, index, persisted, preferencesHint);
     case RequirementEditPart.VISUAL_ID:
       return createRequirement_3003(
           domainElement, containerView, index, persisted, preferencesHint);
     case AssumptionEditPart.VISUAL_ID:
       return createAssumption_3004(
           domainElement, containerView, index, persisted, preferencesHint);
   }
   // can't happen, provided #provides(CreateNodeViewOperation) is correct
   return null;
 }
Пример #2
0
 /** @generated */
 protected boolean provides(CreateNodeViewOperation op) {
   if (op.getContainerView() == null) {
     return false;
   }
   IElementType elementType = getSemanticElementType(op.getSemanticAdapter());
   EObject domainElement = getSemanticElement(op.getSemanticAdapter());
   int visualID;
   if (op.getSemanticHint() == null) {
     // Semantic hint is not specified. Can be a result of call from CanonicalEditPolicy.
     // In this situation there should be NO elementType, visualID will be determined
     // by VisualIDRegistry.getNodeVisualID() for domainElement.
     if (elementType != null || domainElement == null) {
       return false;
     }
     visualID = RdalVisualIDRegistry.getNodeVisualID(op.getContainerView(), domainElement);
   } else {
     visualID = RdalVisualIDRegistry.getVisualID(op.getSemanticHint());
     if (elementType != null) {
       if (!RdalElementTypes.isKnownElementType(elementType)
           || (!(elementType instanceof IHintedType))) {
         return false; // foreign element type
       }
       String elementTypeHint = ((IHintedType) elementType).getSemanticHint();
       if (!op.getSemanticHint().equals(elementTypeHint)) {
         return false; // if semantic hint is specified it should be the same as in element type
       }
       if (domainElement != null
           && visualID
               != RdalVisualIDRegistry.getNodeVisualID(op.getContainerView(), domainElement)) {
         return false; // visual id for node EClass should match visual id from element type
       }
     } else {
       if (!SpecificationEditPart.MODEL_ID.equals(
           RdalVisualIDRegistry.getModelID(op.getContainerView()))) {
         return false; // foreign diagram
       }
       switch (visualID) {
         case RequirementsGroupEditPart.VISUAL_ID:
         case StakeHolderEditPart.VISUAL_ID:
         case VerificationActivityEditPart.VISUAL_ID:
         case RequirementEditPart.VISUAL_ID:
         case AssumptionEditPart.VISUAL_ID:
           if (domainElement == null
               || visualID
                   != RdalVisualIDRegistry.getNodeVisualID(op.getContainerView(), domainElement)) {
             return false; // visual id in semantic hint should match visual id for domain element
           }
           break;
         default:
           return false;
       }
     }
   }
   return RequirementsGroupEditPart.VISUAL_ID == visualID
       || StakeHolderEditPart.VISUAL_ID == visualID
       || VerificationActivityEditPart.VISUAL_ID == visualID
       || RequirementEditPart.VISUAL_ID == visualID
       || AssumptionEditPart.VISUAL_ID == visualID;
 }
Пример #3
0
 /** @generated */
 public Edge createEdge(
     IAdaptable semanticAdapter,
     View containerView,
     String semanticHint,
     int index,
     boolean persisted,
     PreferencesHint preferencesHint) {
   IElementType elementType = getSemanticElementType(semanticAdapter);
   String elementTypeHint = ((IHintedType) elementType).getSemanticHint();
   switch (RdalVisualIDRegistry.getVisualID(elementTypeHint)) {
     case AbstractRequirementContainedRequirementsEditPart.VISUAL_ID:
       return createAbstractRequirementContainedRequirements_4016(
           containerView, index, persisted, preferencesHint);
     case ContractualElementStakeHoldersEditPart.VISUAL_ID:
       return createContractualElementStakeHolders_4020(
           containerView, index, persisted, preferencesHint);
     case AbstractRequirementVerifiedByEditPart.VISUAL_ID:
       return createAbstractRequirementVerifiedBy_4019(
           containerView, index, persisted, preferencesHint);
     case RequirementDerivedFromEditPart.VISUAL_ID:
       return createRequirementDerivedFrom_4014(containerView, index, persisted, preferencesHint);
     case RequirementRefinedByEditPart.VISUAL_ID:
       return createRequirementRefinedBy_4015(containerView, index, persisted, preferencesHint);
     case RequirementAssumptionsEditPart.VISUAL_ID:
       return createRequirementAssumptions_4017(containerView, index, persisted, preferencesHint);
   }
   // can never happen, provided #provides(CreateEdgeViewOperation) is correct
   return null;
 }
Пример #4
0
  /** @generated */
  public Edge createRequirementAssumptions_4017(
      View containerView, int index, boolean persisted, PreferencesHint preferencesHint) {
    Connector edge = NotationFactory.eINSTANCE.createConnector();
    edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
    RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
    ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2);
    points.add(new RelativeBendpoint());
    points.add(new RelativeBendpoint());
    bendpoints.setPoints(points);
    edge.setBendpoints(bendpoints);
    ViewUtil.insertChildView(containerView, edge, index, persisted);
    edge.setType(RdalVisualIDRegistry.getType(RequirementAssumptionsEditPart.VISUAL_ID));
    edge.setElement(null);
    // initializePreferences
    final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();

    org.eclipse.swt.graphics.RGB lineRGB =
        PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_LINE_COLOR);
    ViewUtil.setStructuralFeatureValue(
        edge,
        NotationPackage.eINSTANCE.getLineStyle_LineColor(),
        FigureUtilities.RGBToInteger(lineRGB));
    FontStyle edgeFontStyle = (FontStyle) edge.getStyle(NotationPackage.Literals.FONT_STYLE);
    if (edgeFontStyle != null) {
      FontData fontData =
          PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
      edgeFontStyle.setFontName(fontData.getName());
      edgeFontStyle.setFontHeight(fontData.getHeight());
      edgeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
      edgeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
      org.eclipse.swt.graphics.RGB fontRGB =
          PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
      edgeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
    }
    Routing routing = Routing.get(prefStore.getInt(IPreferenceConstants.PREF_LINE_STYLE));
    if (routing != null) {
      ViewUtil.setStructuralFeatureValue(
          edge, NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
    }
    Node label6010 =
        createLabel(edge, RdalVisualIDRegistry.getType(WrappingLabel4EditPart.VISUAL_ID));
    label6010.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
    Location location6010 = (Location) label6010.getLayoutConstraint();
    location6010.setX(0);
    location6010.setY(40);
    return edge;
  }
Пример #5
0
  /** @generated */
  public Node createStakeHolder_2011(
      EObject domainElement,
      View containerView,
      int index,
      boolean persisted,
      PreferencesHint preferencesHint) {
    Shape node = NotationFactory.eINSTANCE.createShape();
    node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
    node.setType(RdalVisualIDRegistry.getType(StakeHolderEditPart.VISUAL_ID));
    ViewUtil.insertChildView(containerView, node, index, persisted);
    node.setElement(domainElement);
    stampShortcut(containerView, node);
    // initializeFromPreferences
    final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();

    org.eclipse.swt.graphics.RGB lineRGB =
        PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_LINE_COLOR);
    ViewUtil.setStructuralFeatureValue(
        node,
        NotationPackage.eINSTANCE.getLineStyle_LineColor(),
        FigureUtilities.RGBToInteger(lineRGB));
    FontStyle nodeFontStyle = (FontStyle) node.getStyle(NotationPackage.Literals.FONT_STYLE);
    if (nodeFontStyle != null) {
      FontData fontData =
          PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
      nodeFontStyle.setFontName(fontData.getName());
      nodeFontStyle.setFontHeight(fontData.getHeight());
      nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
      nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
      org.eclipse.swt.graphics.RGB fontRGB =
          PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
      nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
    }
    org.eclipse.swt.graphics.RGB fillRGB =
        PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FILL_COLOR);
    ViewUtil.setStructuralFeatureValue(
        node,
        NotationPackage.eINSTANCE.getFillStyle_FillColor(),
        FigureUtilities.RGBToInteger(fillRGB));
    Node label5018 =
        createLabel(node, RdalVisualIDRegistry.getType(StakeHolderNameEditPart.VISUAL_ID));
    label5018.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
    Location location5018 = (Location) label5018.getLayoutConstraint();
    location5018.setX(0);
    location5018.setY(5);
    return node;
  }
Пример #6
0
 /** @generated */
 private void stampShortcut(View containerView, Node target) {
   if (!SpecificationEditPart.MODEL_ID.equals(RdalVisualIDRegistry.getModelID(containerView))) {
     EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
     shortcutAnnotation.setSource("Shortcut"); // $NON-NLS-1$
     shortcutAnnotation.getDetails().put("modelID", SpecificationEditPart.MODEL_ID); // $NON-NLS-1$
     target.getEAnnotations().add(shortcutAnnotation);
   }
 }
Пример #7
0
 /** @generated */
 public Node createRequirementsGroup_2007(
     EObject domainElement,
     View containerView,
     int index,
     boolean persisted,
     PreferencesHint preferencesHint) {
   Node node = NotationFactory.eINSTANCE.createNode();
   node.getStyles().add(NotationFactory.eINSTANCE.createDescriptionStyle());
   node.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
   node.getStyles().add(NotationFactory.eINSTANCE.createFillStyle());
   node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
   node.setType(RdalVisualIDRegistry.getType(RequirementsGroupEditPart.VISUAL_ID));
   ViewUtil.insertChildView(containerView, node, index, persisted);
   node.setElement(domainElement);
   stampShortcut(containerView, node);
   // initializeFromPreferences
   final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
   FontStyle nodeFontStyle = (FontStyle) node.getStyle(NotationPackage.Literals.FONT_STYLE);
   if (nodeFontStyle != null) {
     FontData fontData =
         PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
     nodeFontStyle.setFontName(fontData.getName());
     nodeFontStyle.setFontHeight(fontData.getHeight());
     nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
     nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
     org.eclipse.swt.graphics.RGB fontRGB =
         PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
     nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
   }
   org.eclipse.swt.graphics.RGB fillRGB =
       PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FILL_COLOR);
   ViewUtil.setStructuralFeatureValue(
       node,
       NotationPackage.eINSTANCE.getFillStyle_FillColor(),
       FigureUtilities.RGBToInteger(fillRGB));
   Node label5013 =
       createLabel(node, RdalVisualIDRegistry.getType(RequirementsGroupNameEditPart.VISUAL_ID));
   createCompartment(
       node,
       RdalVisualIDRegistry.getType(RequirementsGroupRequirementsCompartmentEditPart.VISUAL_ID),
       true,
       false,
       false,
       false);
   return node;
 }
Пример #8
0
 /** @generated */
 protected boolean provides(CreateEdgeViewOperation op) {
   IElementType elementType = getSemanticElementType(op.getSemanticAdapter());
   if (!RdalElementTypes.isKnownElementType(elementType)
       || (!(elementType instanceof IHintedType))) {
     return false; // foreign element type
   }
   String elementTypeHint = ((IHintedType) elementType).getSemanticHint();
   if (elementTypeHint == null
       || (op.getSemanticHint() != null && !elementTypeHint.equals(op.getSemanticHint()))) {
     return false; // our hint is visual id and must be specified, and it should be the same as in
                   // element type
   }
   int visualID = RdalVisualIDRegistry.getVisualID(elementTypeHint);
   EObject domainElement = getSemanticElement(op.getSemanticAdapter());
   if (domainElement != null
       && visualID != RdalVisualIDRegistry.getLinkWithClassVisualID(domainElement)) {
     return false; // visual id for link EClass should match visual id from element type
   }
   return true;
 }
Пример #9
0
 /** @generated */
 public IParser getParser() {
   if (parser == null) {
     parser =
         RdalParserProvider.getParser(
             RdalElementTypes.RequirementDerivedFrom_4014,
             getParserElement(),
             RdalVisualIDRegistry.getType(
                 fr.openpeople.rdal.model.core.diagram.edit.parts.WrappingLabel2EditPart
                     .VISUAL_ID));
   }
   return parser;
 }
Пример #10
0
 /** @generated */
 static {
   registerSnapBackPosition(
       RdalVisualIDRegistry.getType(
           fr.openpeople.rdal.model.core.diagram.edit.parts.WrappingLabel2EditPart.VISUAL_ID),
       new Point(0, 40));
 }
Пример #11
0
 /** @generated */
 protected boolean provides(CreateDiagramViewOperation op) {
   return SpecificationEditPart.MODEL_ID.equals(op.getSemanticHint())
       && RdalVisualIDRegistry.getDiagramVisualID(getSemanticElement(op.getSemanticAdapter()))
           != -1;
 }