34
34
class LaunchpadAction : Act
37
static readonly IEnumerable<LaunchpadItem> LaunchpadItems = new LaunchpadItem [] {
38
new LaunchpadAnswerSearchItem(),
39
new LaunchpadProjectAnswersItem(),
40
new LaunchpadBlueprintsItem(),
41
new LaunchpadBlueprintSearchItem(),
42
new LaunchpadBlueprintsRegisterItem(),
43
new LaunchpadBugNumberItem(),
44
new LaunchpadBugReportItem(),
45
new LaunchpadPackageBugsItem(),
46
new LaunchpadBugSearchItem(),
47
new LaunchpadCodeOverviewItem(),
48
new LaunchpadRegisterItem(),
49
new LaunchpadTranslationSearchItem(),
50
new LaunchpadTranslationReleaseItem(),
51
new LaunchpadProjectPageItem(),
52
new LaunchpadUserPageItem(),
53
new LaunchpadUserSearchItem()
36
56
public override string Name
38
58
get { return Catalog.GetString ("Launchpad"); }
48
68
get { return "Launchpad.png@" + GetType ().Assembly.FullName; }
51
public override IEnumerable<Type> SupportedItemTypes
71
public override IEnumerable<Type> SupportedItemTypes {
72
get { yield return typeof (ITextItem); }
61
public override bool ModifierItemsOptional { get { return false; } }
63
75
public override bool SupportsModifierItemForItems (IEnumerable<Item> items, Item modItem)
65
return (modItem as LaunchpadItem).SupportsItems(items.ToArray ());
77
return (modItem as LaunchpadItem).SupportsItems (items.OfType<ITextItem> ());
68
public override IEnumerable<Type> SupportedModifierItemTypes
80
public override IEnumerable<Type> SupportedModifierItemTypes {
81
get { yield return typeof (LaunchpadItem);}
78
84
public override IEnumerable<Item> DynamicModifierItemsForItem (Item item)
81
new LaunchpadAnswerSearchItem(),
82
new LaunchpadProjectAnswersItem(),
83
new LaunchpadBlueprintsItem(),
84
new LaunchpadBlueprintSearchItem(),
85
new LaunchpadBlueprintsRegisterItem(),
86
new LaunchpadBugNumberItem(),
87
new LaunchpadBugReportItem(),
88
new LaunchpadPackageBugsItem(),
89
new LaunchpadBugSearchItem(),
90
new LaunchpadCodeOverviewItem(),
91
new LaunchpadRegisterItem(),
92
new LaunchpadTranslationSearchItem(),
93
new LaunchpadTranslationReleaseItem(),
94
new LaunchpadProjectPageItem(),
95
new LaunchpadUserPageItem(),
96
new LaunchpadUserSearchItem()
86
return LaunchpadItems.OfType<Item> ();
100
public override bool SupportsItem (Item item)
105
public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modItems) {
106
if (modItems.Any ()) {
107
(modItems.First () as LaunchpadItem).Perform(items.First ());
89
public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modItems)
91
foreach (LaunchpadItem lp in modItems)
92
lp.Perform (items.OfType<ITextItem> ());
118
103
/// They are meant to behave just like Actions, but they need to be Items
119
104
/// to be listed in the right-hand box.
121
interface LaunchpadItem : Item
106
public abstract class LaunchpadItem : Item
123
bool SupportsItems(Item[] items);
124
void Perform (Item item);
108
public abstract bool SupportsItems (IEnumerable<ITextItem> items);
109
public abstract void Perform (IEnumerable<ITextItem> items);