コード例 #1
0
 /** @generated */
 private void stampShortcut(View containerView, Node target) {
   if (!GeometryEditPart.MODEL_ID.equals(GeometryVisualIDRegistry.getModelID(containerView))) {
     EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
     shortcutAnnotation.setSource("Shortcut"); // $NON-NLS-1$
     shortcutAnnotation.getDetails().put("modelID", GeometryEditPart.MODEL_ID); // $NON-NLS-1$
     target.getEAnnotations().add(shortcutAnnotation);
   }
 }
コード例 #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 = GeometryVisualIDRegistry.getNodeVisualID(op.getContainerView(), domainElement);
   } else {
     visualID = GeometryVisualIDRegistry.getVisualID(op.getSemanticHint());
     if (elementType != null) {
       if (!GeometryElementTypes.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
               != GeometryVisualIDRegistry.getNodeVisualID(op.getContainerView(), domainElement)) {
         return false; // visual id for node EClass should match visual id from element type
       }
     } else {
       if (!GeometryEditPart.MODEL_ID.equals(
           GeometryVisualIDRegistry.getModelID(op.getContainerView()))) {
         return false; // foreign diagram
       }
       switch (visualID) {
         case PointEditPart.VISUAL_ID:
           if (domainElement == null
               || visualID
                   != GeometryVisualIDRegistry.getNodeVisualID(
                       op.getContainerView(), domainElement)) {
             return false; // visual id in semantic hint should match visual id for domain element
           }
           break;
         default:
           return false;
       }
     }
   }
   return PointEditPart.VISUAL_ID == visualID;
 }
コード例 #3
0
 /** @generated */
 protected boolean provides(CreateDiagramViewOperation op) {
   return GeometryEditPart.MODEL_ID.equals(op.getSemanticHint())
       && GeometryVisualIDRegistry.getDiagramVisualID(getSemanticElement(op.getSemanticAdapter()))
           != -1;
 }