/** @generated */ public static int getNodeVisualID(View containerView, EObject domainElement) { if (domainElement == null) { return -1; } String containerModelID = org.eclipse.gmf.tooling.examples.shortcut.diagram.part.ShortcutVisualIDRegistry.getModelID( containerView); if (!DiagramEditPart.MODEL_ID.equals(containerModelID) && !"Shortcut".equals(containerModelID)) { // $NON-NLS-1$ return -1; } int containerVisualID; if (DiagramEditPart.MODEL_ID.equals(containerModelID)) { containerVisualID = org.eclipse.gmf.tooling.examples.shortcut.diagram.part.ShortcutVisualIDRegistry .getVisualID(containerView); } else { if (containerView instanceof Diagram) { containerVisualID = DiagramEditPart.VISUAL_ID; } else { return -1; } } switch (containerVisualID) { case DiagramEditPart.VISUAL_ID: if (ShortcutPackage.eINSTANCE.getDiagramNode().isSuperTypeOf(domainElement.eClass())) { return DiagramNodeEditPart.VISUAL_ID; } break; } return -1; }
/** @generated */ public static boolean canCreateNode(View containerView, int nodeVisualID) { String containerModelID = org.eclipse.gmf.tooling.examples.shortcut.diagram.part.ShortcutVisualIDRegistry.getModelID( containerView); if (!DiagramEditPart.MODEL_ID.equals(containerModelID) && !"Shortcut".equals(containerModelID)) { // $NON-NLS-1$ return false; } int containerVisualID; if (DiagramEditPart.MODEL_ID.equals(containerModelID)) { containerVisualID = org.eclipse.gmf.tooling.examples.shortcut.diagram.part.ShortcutVisualIDRegistry .getVisualID(containerView); } else { if (containerView instanceof Diagram) { containerVisualID = DiagramEditPart.VISUAL_ID; } else { return false; } } switch (containerVisualID) { case DiagramEditPart.VISUAL_ID: if (DiagramNodeEditPart.VISUAL_ID == nodeVisualID) { return true; } break; case DiagramNodeEditPart.VISUAL_ID: if (DiagramNodeNameEditPart.VISUAL_ID == nodeVisualID) { return true; } break; } return false; }
/** @generated */ public static int getVisualID(View view) { if (view instanceof Diagram) { if (DiagramEditPart.MODEL_ID.equals(view.getType())) { return DiagramEditPart.VISUAL_ID; } else { return -1; } } return org.eclipse.gmf.tooling.examples.shortcut.diagram.part.ShortcutVisualIDRegistry .getVisualID(view.getType()); }