public static GenericMenu CreateGraphContextMenu(BTEditorGraph graph) { GenericMenu menu = new GenericMenu(); if (BTUndoSystem.CanUndo && !graph.ReadOnly) { BTUndoState topUndo = BTUndoSystem.PeekUndo(); menu.AddItem(new GUIContent(string.Format("Undo \"{0}\"", topUndo.Title)), false, () => BTUndoSystem.Undo()); } else { menu.AddDisabledItem(new GUIContent("Undo")); } if (BTUndoSystem.CanRedo && !graph.ReadOnly) { BTUndoState topRedo = BTUndoSystem.PeekRedo(); menu.AddItem(new GUIContent(string.Format("Redo \"{0}\"", topRedo.Title)), false, () => BTUndoSystem.Redo()); } else { menu.AddDisabledItem(new GUIContent("Redo")); } menu.AddSeparator(""); if (!graph.ReadOnly) { menu.AddItem(new GUIContent("Select All"), false, () => graph.SelectEntireGraph()); } else { menu.AddDisabledItem(new GUIContent("Select All")); } menu.AddItem(new GUIContent("Delete All Breakpoints"), false, () => graph.DeleteAllBreakpoints()); return(menu); }