Exemplo n.º 1
0
        void HandleEntityContextClick(IEnumerable <T> entities)
        {
            var menu = new GenericMenu();

            // a vertex can be folded when it produces fold-vertices
            if (entities.Any(e => FoldUtil.GetFoldVertices(graph, e, parent.IsSeed).Any()))
            {
                menu.AddItem(new GUIContent("Fold"), false, () =>
                {
                    foreach (var ent in entities)
                    {
                        parent.GetAPI().FoldEntity(ent);
                    }
                });
            }
            ;

            // a vertex can be expanded when it is marked as unexplored
            if (entities.Any(e => graph.VerticesData[e].unexplored))
            {
                menu.AddItem(new GUIContent("Expand"), false, () =>
                {
                    foreach (var ent in entities)
                    {
                        parent.GetAPI().ExpandEntity(ent);
                    }
                });
            }

            parent.GetBackend().OnEntityContextClick(entities, menu);
            if (menu.GetItemCount() > 0)
            {
                menu.ShowAsContext();
            }
        }
Exemplo n.º 2
0
        void IWorkspace.FoldEntity(object entityObj)
        {
            var entity = entityObj as T;

            if (entity == null)
            {
                Log.Error("Can't fold null entity");
                return;
            }

            if (graph != null)
            {
                FoldUtil.Fold(graph, entity, IsSeed);
            }
        }