/**
   * Returns the modelObject ID string from the given Graphiti context.
   *
   * @param context
   * @return - ID string for this modelObject.
   */
  public static String getId(IContext context) {
    Object id = null;

    /**
     * IAddContext can also mean that a file is dragged, therefore we have to check if we are really
     * dragging a customTask
     */
    if (context instanceof IAddContext
        && ((IAddContext) context).getNewObject() instanceof EObject) {
      EObject object = (EObject) ((IAddContext) context).getNewObject();
      TargetRuntime rt = TargetRuntime.getCurrentRuntime();
      for (CustomTaskDescriptor ct : rt.getCustomTasks()) {
        id = ct.getFeatureContainer().getId(object);
        if (id != null) {
          context.putProperty(CUSTOM_TASK_ID, id);
          return (String) id;
        }
      }
    }

    if (context instanceof IPictogramElementContext) {
      PictogramElement pe = ((IPictogramElementContext) context).getPictogramElement();
      id = Graphiti.getPeService().getPropertyValue(pe, CUSTOM_TASK_ID);
    } else {
      id = context.getProperty(CUSTOM_TASK_ID);
    }
    return (String) id;
  }