Exemple #1
0
 IEdmTypeReference IDataTypeVisitor <IEdmTypeReference> .Visit(ReferenceDataType dataType)
 {
     throw new System.NotImplementedException();
     ////var entityTypeDefinition = (IEdmEntityType)this.currentEdmModel.FindSchemaElement(dataType.EntityType.FullName);
     ////return entityTypeDefinition.ToEntityReferenceTypeReference()
     ////                           .Nullable(dataType.IsNullable);
 }
    private static Rect OnGUIAdvancedOptions(Rect current, SerializedProperty property,
                                             ReferenceDrawerType drawerType, ReferenceDataType dataType)
    {
        SerializedProperty advancedFoldout = property.FindPropertyRelative("advancedFoldout");

        advancedFoldout.boolValue = EditorGUI.Foldout(current, advancedFoldout.boolValue, new GUIContent("Advanced"));
        current.y += GraphingEditorUtility.standardControlHeight;

        if (advancedFoldout.boolValue)
        {
            EditorGUI.indentLevel++;

            // If drawer is input, display redirect type
            if (drawerType == ReferenceDrawerType.Input && dataType == ReferenceDataType.GameObjectOrComponent)
            {
                EditorGUI.PropertyField(current, property.FindPropertyRelative("redirectType"));
                current.y += GraphingEditorUtility.standardControlHeight;
            }

            // Display redirect depth
            EditorGUI.PropertyField(current, property.FindPropertyRelative("redirectDepth"));
            current.y += GraphingEditorUtility.standardControlHeight;

            EditorGUI.indentLevel--;
        }

        return(current);
    }
    public static float GetPropertyHeight(SerializedProperty property, GUIContent content,
                                          ReferenceDrawerType drawerType, ReferenceDataType dataType)
    {
        // Get foldout values
        bool mainFoldout     = property.FindPropertyRelative("mainFoldout").boolValue;
        bool advancedFoldout = property.FindPropertyRelative("advancedFoldout").boolValue;

        // Start with the main foldout line
        float current = GraphingEditorUtility.standardControlHeight;

        if (mainFoldout)
        {
            SerializedProperty evaluationType = property.FindPropertyRelative("evaluationType");
            SerializedProperty referenceType  = property.FindPropertyRelative("referenceType");

            // If this is an input, account for the evaluation type
            if (drawerType == ReferenceDrawerType.Input)
            {
                current += GraphingEditorUtility.standardControlHeight;
            }

            // Account for reference type height
            current += GraphingEditorUtility.standardControlHeight;

            // Account for value height
            if (referenceType.enumValueIndex == 0 && evaluationType.enumValueIndex == 0)
            {
                current += EditorGUI.GetPropertyHeight(property.FindPropertyRelative("directValue"));
            }
            else
            {
                current += GraphingEditorUtility.standardControlHeight;
            }

            // If reference is a redirect, account for game object redirect type and advanced foldout
            if (referenceType.enumValueIndex == 2)
            {
                current += 2f * GraphingEditorUtility.standardControlHeight;

                // If advanced options are opened up, account for redirect depth
                if (advancedFoldout)
                {
                    current += GraphingEditorUtility.standardControlHeight;

                    // If reference drawer is for input and a GameObject or Component,
                    // account for redirect type height
                    if (drawerType == ReferenceDrawerType.Input && dataType == ReferenceDataType.GameObjectOrComponent)
                    {
                        current += GraphingEditorUtility.standardControlHeight;
                    }
                }
            }
        }

        return(current);
    }
    public static void OnGUI(Rect position, SerializedProperty property, GUIContent label,
                             ReferenceDrawerType drawerType, ReferenceDataType dataType)
    {
        SerializedProperty mainFoldout     = property.FindPropertyRelative("mainFoldout");
        SerializedProperty advancedFoldout = property.FindPropertyRelative("advancedFoldout");

        // Get starting rect
        Rect rect = new Rect(position.position, new Vector2(position.width, GraphingEditorUtility.standardControlHeight));

        // Put the foldout item
        mainFoldout.boolValue = EditorGUI.Foldout(rect, mainFoldout.boolValue, label);
        rect.y += GraphingEditorUtility.standardControlHeight;

        if (mainFoldout.boolValue)
        {
            // Put the evaluation type
            EditorGUI.indentLevel++;
            rect = OnGUIEvaluationType(rect, property, drawerType);

            // Put the reference type
            rect = OnGUIReferenceType(rect, property, drawerType);

            switch (property.FindPropertyRelative("referenceType").enumValueIndex)
            {
            // GUI for a direct value
            case 0:
                rect = OnGUIDirectValue(rect, property, drawerType);
                break;

            // GUI for the indirect value
            case 1:
                rect = OnGUIIndirectValue(rect, property, drawerType);
                break;

            // GUI for a redirected value
            case 2:
                // Display redirected value options
                rect = OnGUIRedirectedValue(rect, property, drawerType);

                // Display advanced options
                rect = OnGUIAdvancedOptions(rect, property, drawerType, dataType);

                break;
            }

            EditorGUI.indentLevel--;
        }
    }
Exemple #5
0
 /// <summary>
 /// Initializes static members of the DataTypes class.
 /// </summary>
 static DataTypes()
 {
     Integer = new IntegerDataType();
     Stream = new StreamDataType();
     String = new StringDataType();
     Boolean = new BooleanDataType();
     FixedPoint = new FixedPointDataType();
     FloatingPoint = new FloatingPointDataType();
     DateTime = new DateTimeDataType();
     Binary = new BinaryDataType();
     Guid = new GuidDataType();
     TimeOfDay = new TimeOfDayDataType();
     ComplexType = new ComplexDataType();
     EntityType = new EntityDataType();
     CollectionType = new CollectionDataType();
     ReferenceType = new ReferenceDataType();
     RowType = new RowDataType();
     EnumType = new EnumDataType();
     Spatial = new SpatialDataType();
 }
Exemple #6
0
        /// <summary>
        /// Helper to get CodeTypeReference for given data type.
        /// </summary>
        /// <param name="annotations">list of annotations to find Collection Type from</param>
        /// <param name="type">DataType to get CodeTypeReference</param>
        /// <returns>CodeTypeReference for the DataType</returns>
        protected CodeTypeReference GetParameterTypeOrFunctionReturnTypeReference(IEnumerable <Annotation> annotations, DataType type)
        {
            ExceptionUtilities.CheckObjectNotNull(type, "DataType is null.");

            var collectionDataType = type as CollectionDataType;

            if (collectionDataType != null)
            {
                return(this.GetCollectionType(CodeGenerationTypeUsage.Declaration, annotations, collectionDataType.ElementDataType));
            }

            ReferenceDataType referenceDataType = type as ReferenceDataType;

            if (referenceDataType != null)
            {
                ExceptionUtilities.Assert(referenceDataType.EntityType != null, "Does not handle non-EntityType referenceDataType");
                return(this.BackingTypeResolver.ResolveClrTypeReference(referenceDataType.EntityType));
            }
            else
            {
                return(this.BackingTypeResolver.ResolveClrTypeReference(type));
            }
        }
 /// <summary>
 /// Resolves the specified type into its type reference.
 /// </summary>
 /// <param name="dataType">The data type.</param>
 /// <returns>CodeTypeReference that should be used in code to refer to the type.</returns>
 public virtual CodeTypeReference Visit(ReferenceDataType dataType)
 {
     throw new TaupoNotSupportedException("Taupo does not support code gen for reference data type yet.");
 }
Exemple #8
0
 /// <summary>
 /// Gets the short qualified Edm name
 /// </summary>
 /// <param name="dataType">The data type.</param>
 /// <returns>short qualified Edm name</returns>
 public string Visit(ReferenceDataType dataType)
 {
     throw new TaupoInvalidOperationException(string.Format(CultureInfo.InvariantCulture, "{0} does not have Edm short qualified name.", dataType));
 }
Exemple #9
0
 /// <summary>
 /// Visits the specified reference type.
 /// </summary>
 /// <param name="dataType">Data type.</param>
 /// <returns>the corresponding default query type.</returns>
 public QueryType Visit(ReferenceDataType dataType)
 {
     return(this.parent.GetDefaultQueryTypeForReference(dataType));
 }
Exemple #10
0
 private QueryReferenceType GetDefaultQueryTypeForReference(ReferenceDataType referenceDataType)
 {
     ExceptionUtilities.CheckObjectNotNull(referenceDataType.EntityType, "Cannot determine QueryType for Reference with no EntityType");
     return(this.defaultQueryEntityTypes[referenceDataType.EntityType].CreateReferenceType());
 }
 /// <summary>
 /// Visits the specified reference data type.
 /// </summary>
 /// <param name="dataType">Data type.</param>
 /// <returns>Implementation-specific value.</returns>
 public IList <string> Visit(ReferenceDataType dataType)
 {
     throw new TaupoNotSupportedException("Properties with reference data type are not supported.");
 }
 /// <summary>
 /// Visits the specified reference type.
 /// </summary>
 /// <param name="dataType">Data type.</param>
 /// <returns>the data type with all references resolved</returns>
 public DataType Visit(ReferenceDataType dataType)
 {
     return(DataTypes.ReferenceType
            .Nullable(dataType.IsNullable)
            .WithEntityType(this.parent.ResolveEntityTypeReference(this.model, dataType.EntityType)));
 }
Exemple #13
0
 /// <summary>
 /// Visits a reference data type
 /// </summary>
 /// <param name="dataType">The data type to visit</param>
 /// <returns>The backing type for the data type</returns>
 public CodeTypeReference Visit(ReferenceDataType dataType)
 {
     throw new TaupoNotSupportedException("Not supported");
 }
Exemple #14
0
 public List <ReferenceData> GetReferenceDataListByType(ReferenceDataType type)
 {
     return(GetReferenceData((int)type));
 }
 /// <summary>
 /// Visits the specified data type.
 /// </summary>
 /// <param name="dataType">The data type.</param>
 /// <returns>Name of the reference type.</returns>
 public string Visit(ReferenceDataType dataType)
 {
     return("Ref(" + this.parent.GetFullyQualifiedName(dataType.EntityType) + ")");
 }
 /// <summary>
 /// Visits the specified reference type.
 /// </summary>
 /// <param name="dataType">Data type.</param>
 /// <returns>A clone of the specified <see cref="DataType"/>.</returns>
 public DataType Visit(ReferenceDataType dataType)
 {
     return(new ReferenceDataType()
            .Nullable(dataType.IsNullable)
            .WithEntityType(dataType.EntityType.NameOrNull()));
 }
Exemple #17
0
 /// <summary>
 /// Resolves enum definitions in enum data types
 /// </summary>
 /// <param name="dataType">the data type</param>
 /// <returns>Resolved data type</returns>
 public DataType Visit(ReferenceDataType dataType)
 {
     this.EnumDefinitionFixup(dataType.EntityType.NamespaceName, dataType.EntityType);
     return(dataType);
 }
Exemple #18
0
 /// <summary>
 /// Visits the specified data type.
 /// </summary>
 /// <param name="dataType">The data type to visit.</param>
 /// <returns>The data types</returns>
 public IEnumerable <DataType> Visit(ReferenceDataType dataType)
 {
     throw new TaupoNotSupportedException("Not supported");
 }
Exemple #19
0
 public virtual void VisitReferenceDataType(ReferenceDataType referenceDataType)
 {
     DefaultVisit(referenceDataType);
 }