/** @generated */
  public Edge createAssociation_4001(
      EObject domainElement,
      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(
        edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part
            .NECSIS14_ClassDiagramVisualIDRegistry.getType(
            edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts
                .AssociationEditPart.VISUAL_ID));
    edge.setElement(domainElement);
    // 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 label6001 =
        createLabel(
            edge,
            edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part
                .NECSIS14_ClassDiagramVisualIDRegistry.getType(
                edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts
                    .AssociationNameEditPart.VISUAL_ID));
    label6001.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
    Location location6001 = (Location) label6001.getLayoutConstraint();
    location6001.setX(0);
    location6001.setY(40);
    return edge;
  }
 /** @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 =
         edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part
             .NECSIS14_ClassDiagramVisualIDRegistry.getNodeVisualID(containerView, domainElement);
   } else {
     visualID =
         edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part
             .NECSIS14_ClassDiagramVisualIDRegistry.getVisualID(semanticHint);
   }
   switch (visualID) {
     case edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts.ClassEditPart
         .VISUAL_ID:
       return createClass_2001(domainElement, containerView, index, persisted, preferencesHint);
     case edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts.AttributeEditPart
         .VISUAL_ID:
       return createAttribute_3001(
           domainElement, containerView, index, persisted, preferencesHint);
   }
   // can't happen, provided #provides(CreateNodeViewOperation) is correct
   return null;
 }
 /** @generated */
 protected boolean provides(CreateEdgeViewOperation op) {
   IElementType elementType = getSemanticElementType(op.getSemanticAdapter());
   if (!edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.providers
           .NECSIS14_ClassDiagramElementTypes.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 =
       edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part
           .NECSIS14_ClassDiagramVisualIDRegistry.getVisualID(elementTypeHint);
   EObject domainElement = getSemanticElement(op.getSemanticAdapter());
   if (domainElement != null
       && visualID
           != edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part
               .NECSIS14_ClassDiagramVisualIDRegistry.getLinkWithClassVisualID(domainElement)) {
     return false; // visual id for link EClass should match visual id from element type
   }
   return true;
 }
  /** @generated */
  public Node createAttribute_3001(
      EObject domainElement,
      View containerView,
      int index,
      boolean persisted,
      PreferencesHint preferencesHint) {
    Shape node = NotationFactory.eINSTANCE.createShape();
    node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
    node.setType(
        edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part
            .NECSIS14_ClassDiagramVisualIDRegistry.getType(
            edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts.AttributeEditPart
                .VISUAL_ID));
    ViewUtil.insertChildView(containerView, node, index, persisted);
    node.setElement(domainElement);
    // 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 label5001 =
        createLabel(
            node,
            edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part
                .NECSIS14_ClassDiagramVisualIDRegistry.getType(
                edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts
                    .AttributeNameEditPart.VISUAL_ID));
    return node;
  }
 /** @generated */
 protected boolean provides(CreateDiagramViewOperation op) {
   return edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts
           .ClassDiagramEditPart.MODEL_ID.equals(op.getSemanticHint())
       && edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part
               .NECSIS14_ClassDiagramVisualIDRegistry.getDiagramVisualID(
               getSemanticElement(op.getSemanticAdapter()))
           != -1;
 }
 /** @generated */
 private void stampShortcut(View containerView, Node target) {
   if (!edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts.ClassDiagramEditPart
       .MODEL_ID.equals(
       edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part
           .NECSIS14_ClassDiagramVisualIDRegistry.getModelID(containerView))) {
     EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
     shortcutAnnotation.setSource("Shortcut"); // $NON-NLS-1$
     shortcutAnnotation
         .getDetails()
         .put(
             "modelID",
             edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts
                 .ClassDiagramEditPart.MODEL_ID); //$NON-NLS-1$
     target.getEAnnotations().add(shortcutAnnotation);
   }
 }
 /** @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 (edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part
       .NECSIS14_ClassDiagramVisualIDRegistry.getVisualID(elementTypeHint)) {
     case edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts
         .AssociationEditPart.VISUAL_ID:
       return createAssociation_4001(
           getSemanticElement(semanticAdapter), containerView, index, persisted, preferencesHint);
     case edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts
         .ClassParentEditPart.VISUAL_ID:
       return createClassParent_4002(containerView, index, persisted, preferencesHint);
   }
   // can never happen, provided #provides(CreateEdgeViewOperation) is correct
   return null;
 }
 /** @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 =
         edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part
             .NECSIS14_ClassDiagramVisualIDRegistry.getNodeVisualID(
             op.getContainerView(), domainElement);
   } else {
     visualID =
         edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part
             .NECSIS14_ClassDiagramVisualIDRegistry.getVisualID(op.getSemanticHint());
     if (elementType != null) {
       if (!edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.providers
               .NECSIS14_ClassDiagramElementTypes.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
               != edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part
                   .NECSIS14_ClassDiagramVisualIDRegistry.getNodeVisualID(
                   op.getContainerView(), domainElement)) {
         return false; // visual id for node EClass should match visual id from element type
       }
     } else {
       if (!edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts
           .ClassDiagramEditPart.MODEL_ID.equals(
           edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part
               .NECSIS14_ClassDiagramVisualIDRegistry.getModelID(op.getContainerView()))) {
         return false; // foreign diagram
       }
       switch (visualID) {
         case edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts.ClassEditPart
             .VISUAL_ID:
         case edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts
             .AttributeEditPart.VISUAL_ID:
           if (domainElement == null
               || visualID
                   != edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part
                       .NECSIS14_ClassDiagramVisualIDRegistry.getNodeVisualID(
                       op.getContainerView(), domainElement)) {
             return false; // visual id in semantic hint should match visual id for domain element
           }
           break;
         default:
           return false;
       }
     }
   }
   return edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts.ClassEditPart
               .VISUAL_ID
           == visualID
       || edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts.AttributeEditPart
               .VISUAL_ID
           == visualID;
 }