private void Evaluate(Node node) { if (node.userData is SearchExpressionNode ex) { switch (ex.type) { case ExpressionType.Results: m_Expression.Evaluate(); break; case ExpressionType.Search: case ExpressionType.Select: case ExpressionType.Union: case ExpressionType.Intersect: case ExpressionType.Except: case ExpressionType.Expression: case ExpressionType.Map: m_Expression.EvaluateNode(ex); break; case ExpressionType.Value: case ExpressionType.Provider: ex = m_Expression.FromSource(ex); if (ex != null) { m_Expression.EvaluateNode(ex); } break; default: throw new ExpressionException($"Evaluation of {ex.id} of type {ex.type} is not supported"); } } }
private void InitializeExpression() { if (m_Expression != null) { return; } m_ExpressionPath = AssetDatabase.GetAssetPath(target); m_ExpressionName = Path.GetFileNameWithoutExtension(m_ExpressionPath); m_ExpressionTitle = new GUIContent(m_ExpressionName, Icons.quicksearch, m_ExpressionPath); m_Expression = new SearchExpression(SearchSettings.GetContextOptions()); m_Expression.Load(m_ExpressionPath); m_Expression.Evaluate(); }
protected override void OnHeaderGUI() { GUILayout.BeginHorizontal(); using (new EditorGUIUtility.IconSizeScope(new Vector2(16, 16))) GUILayout.Label(m_ExpressionTitle); GUILayout.FlexibleSpace(); if (Utils.isDeveloperBuild) { if (GUILayout.Button("Refresh")) { m_Expression.Evaluate(); } } if (GUILayout.Button("Select")) { EditorGUIUtility.PingObject(target); } if (GUILayout.Button("Edit")) { ExpressionBuilder.Open(m_ExpressionPath); } GUILayout.EndHorizontal(); }
public void Evaluate() { m_Expression.Evaluate(); }