コード例 #1
0
  /** @generated */
  public String getText(Object element) {
    if (false == element instanceof GMFMapAbstractNavigatorItem) {
      return super.getText(element);
    }

    GMFMapAbstractNavigatorItem abstractNavigatorItem = (GMFMapAbstractNavigatorItem) element;
    if (!MappingEditPart.MODEL_ID.equals(abstractNavigatorItem.getModelID())) {
      return super.getText(element);
    }

    if (abstractNavigatorItem instanceof GMFMapNavigatorItem) {
      GMFMapNavigatorItem navigatorItem = (GMFMapNavigatorItem) abstractNavigatorItem;
      switch (navigatorItem.getVisualID()) {
        case CanvasMappingEditPart.VISUAL_ID:
          return getCanvasMapping_2001Text(navigatorItem.getView());
        case NodeMappingEditPart.VISUAL_ID:
          return getNodeMapping_2003Text(navigatorItem.getView());
        case LinkMappingEditPart.VISUAL_ID:
          return getLinkMapping_2002Text(navigatorItem.getView());
        case TopNodeReferenceEditPart.VISUAL_ID:
          return getTopNodeReference_3001Text(navigatorItem.getView());
        case FeatureLabelMappingEditPart.VISUAL_ID:
          return getFeatureLabelMapping_3006Text(navigatorItem.getView());
        case DesignLabelMappingEditPart.VISUAL_ID:
          return getDesignLabelMapping_3007Text(navigatorItem.getView());
        case LabelMappingEditPart.VISUAL_ID:
          return getLabelMapping_3002Text(navigatorItem.getView());
        case ChildReferenceEditPart.VISUAL_ID:
          return getChildReference_3004Text(navigatorItem.getView());
        case CompartmentMappingEditPart.VISUAL_ID:
          return getCompartmentMapping_3005Text(navigatorItem.getView());
        case FeatureLabelMapping2EditPart.VISUAL_ID:
          return getFeatureLabelMapping_3008Text(navigatorItem.getView());
        case DesignLabelMapping2EditPart.VISUAL_ID:
          return getDesignLabelMapping_3009Text(navigatorItem.getView());
        case LabelMapping2EditPart.VISUAL_ID:
          return getLabelMapping_3003Text(navigatorItem.getView());
        case MappingEditPart.VISUAL_ID:
          return getMapping_1000Text(navigatorItem.getView());
        case TopNodeReferenceOwnedChildEditPart.VISUAL_ID:
          return getTopNodeReferenceOwnedChild_4001Text(navigatorItem.getView());
        case ChildReferenceOwnedChildEditPart.VISUAL_ID:
          return getChildReferenceOwnedChild_4004Text(navigatorItem.getView());
        case ChildReferenceReferencedChildEditPart.VISUAL_ID:
          return getChildReferenceReferencedChild_4002Text(navigatorItem.getView());
        case CompartmentMappingChildrenEditPart.VISUAL_ID:
          return getCompartmentMappingChildren_4003Text(navigatorItem.getView());
        default:
          return getUnknownElementText(navigatorItem.getView());
      }
    } else if (abstractNavigatorItem instanceof GMFMapNavigatorGroup) {
      GMFMapNavigatorGroup group = (GMFMapNavigatorGroup) element;
      return group.getGroupName();
    }
    return super.getText(element);
  }
 /** @generated */
 protected void decorateView(
     View containerView,
     View view,
     IAdaptable semanticAdapter,
     String semanticHint,
     int index,
     boolean persisted) {
   if (semanticHint == null) {
     semanticHint =
         GMFMapVisualIDRegistry.getType(
             org.eclipse.gmf.map.editor.edit.parts.ChildReferenceOwnedChildEditPart.VISUAL_ID);
     view.setType(semanticHint);
   }
   super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
   if (!MappingEditPart.MODEL_ID.equals(GMFMapVisualIDRegistry.getModelID(containerView))) {
     EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
     shortcutAnnotation.setSource("Shortcut"); // $NON-NLS-1$
     shortcutAnnotation.getDetails().put("modelID", MappingEditPart.MODEL_ID); // $NON-NLS-1$
     view.getEAnnotations().add(shortcutAnnotation);
   }
 }
コード例 #3
0
  /** @generated */
  public Image getImage(Object element) {
    if (false == element instanceof GMFMapAbstractNavigatorItem) {
      return super.getImage(element);
    }

    GMFMapAbstractNavigatorItem abstractNavigatorItem = (GMFMapAbstractNavigatorItem) element;
    if (!MappingEditPart.MODEL_ID.equals(abstractNavigatorItem.getModelID())) {
      return super.getImage(element);
    }

    if (abstractNavigatorItem instanceof GMFMapNavigatorItem) {
      GMFMapNavigatorItem navigatorItem = (GMFMapNavigatorItem) abstractNavigatorItem;
      switch (navigatorItem.getVisualID()) {
        case CanvasMappingEditPart.VISUAL_ID:
          return getImage(
              "Navigator?TopLevelNode?http://www.eclipse.org/gmf/2006/mappings?CanvasMapping",
              GMFMapElementTypes.CanvasMapping_2001);
        case NodeMappingEditPart.VISUAL_ID:
          return getImage(
              "Navigator?TopLevelNode?http://www.eclipse.org/gmf/2006/mappings?NodeMapping",
              GMFMapElementTypes.NodeMapping_2003);
        case LinkMappingEditPart.VISUAL_ID:
          return getImage(
              "Navigator?TopLevelNode?http://www.eclipse.org/gmf/2006/mappings?LinkMapping",
              GMFMapElementTypes.LinkMapping_2002);
        case TopNodeReferenceEditPart.VISUAL_ID:
          return getImage(
              "Navigator?Node?http://www.eclipse.org/gmf/2006/mappings?TopNodeReference",
              GMFMapElementTypes.TopNodeReference_3001);
        case FeatureLabelMappingEditPart.VISUAL_ID:
          return getImage(
              "Navigator?Node?http://www.eclipse.org/gmf/2006/mappings?FeatureLabelMapping",
              GMFMapElementTypes.FeatureLabelMapping_3006);
        case DesignLabelMappingEditPart.VISUAL_ID:
          return getImage(
              "Navigator?Node?http://www.eclipse.org/gmf/2006/mappings?DesignLabelMapping",
              GMFMapElementTypes.DesignLabelMapping_3007);
        case LabelMappingEditPart.VISUAL_ID:
          return getImage(
              "Navigator?Node?http://www.eclipse.org/gmf/2006/mappings?LabelMapping",
              GMFMapElementTypes.LabelMapping_3002);
        case ChildReferenceEditPart.VISUAL_ID:
          return getImage(
              "Navigator?Node?http://www.eclipse.org/gmf/2006/mappings?ChildReference",
              GMFMapElementTypes.ChildReference_3004);
        case CompartmentMappingEditPart.VISUAL_ID:
          return getImage(
              "Navigator?Node?http://www.eclipse.org/gmf/2006/mappings?CompartmentMapping",
              GMFMapElementTypes.CompartmentMapping_3005);
        case FeatureLabelMapping2EditPart.VISUAL_ID:
          return getImage(
              "Navigator?Node?http://www.eclipse.org/gmf/2006/mappings?FeatureLabelMapping",
              GMFMapElementTypes.FeatureLabelMapping_3008);
        case DesignLabelMapping2EditPart.VISUAL_ID:
          return getImage(
              "Navigator?Node?http://www.eclipse.org/gmf/2006/mappings?DesignLabelMapping",
              GMFMapElementTypes.DesignLabelMapping_3009);
        case LabelMapping2EditPart.VISUAL_ID:
          return getImage(
              "Navigator?Node?http://www.eclipse.org/gmf/2006/mappings?LabelMapping",
              GMFMapElementTypes.LabelMapping_3003);
        case MappingEditPart.VISUAL_ID:
          return getImage(
              "Navigator?Diagram?http://www.eclipse.org/gmf/2006/mappings?Mapping",
              GMFMapElementTypes.Mapping_1000);
        case TopNodeReferenceOwnedChildEditPart.VISUAL_ID:
          return getImage(
              "Navigator?Link?http://www.eclipse.org/gmf/2006/mappings?TopNodeReference?ownedChild",
              GMFMapElementTypes.TopNodeReferenceOwnedChild_4001);
        case ChildReferenceOwnedChildEditPart.VISUAL_ID:
          return getImage(
              "Navigator?Link?http://www.eclipse.org/gmf/2006/mappings?ChildReference?ownedChild",
              GMFMapElementTypes.ChildReferenceOwnedChild_4004);
        case ChildReferenceReferencedChildEditPart.VISUAL_ID:
          return getImage(
              "Navigator?Link?http://www.eclipse.org/gmf/2006/mappings?ChildReference?referencedChild",
              GMFMapElementTypes.ChildReferenceReferencedChild_4002);
        case CompartmentMappingChildrenEditPart.VISUAL_ID:
          return getImage(
              "Navigator?Link?http://www.eclipse.org/gmf/2006/mappings?CompartmentMapping?children",
              GMFMapElementTypes.CompartmentMappingChildren_4003);
        default:
          return getImage("Navigator?UnknownElement", null);
      }
    } else if (abstractNavigatorItem instanceof GMFMapNavigatorGroup) {
      GMFMapNavigatorGroup group = (GMFMapNavigatorGroup) element;
      return GMFMapDiagramEditorPlugin.getInstance().getBundledImage(group.getIcon());
    }
    return super.getImage(element);
  }