private void ContextMenu(Model instance)
{
var menu = new GenericMenu();
menu.AddItem(new GUIContent("New"), false, New);
if (instance != null) {
menu.AddItem(new GUIContent("Edit"), false, ShowEditWindow, instance);
} else {
menu.AddDisabledItem(new GUIContent("Edit"));
}
menu.AddSeparator("");
if (instance != null) {
menu.AddItem(new GUIContent("Copy"), false, Copy, instance);
} else {
menu.AddDisabledItem(new GUIContent("Copy"));
}
if (CanPaste()) {
menu.AddItem(new GUIContent("Paste"), false, Paste);
} else {
menu.AddDisabledItem(new GUIContent("Paste"));
}
if (instance != null) {
menu.AddItem(new GUIContent("Delete"), false, Delete, instance);
} else {
menu.AddDisabledItem(new GUIContent("Delete"));
}
menu.ShowAsContext();
}