/// <summary> /// Creates an item with the specified sub items. And the current /// Condition status for this item. /// </summary> public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions) { if (subItems.Count > 0) { throw new ApplicationException("more than one level of file filters don't make sense!"); } return Runtime.StringParserService.Parse(filtername) + "|" + String.Join(";", extensions); }
/// <summary> /// Creates an item with the specified sub items. And the current /// Condition status for this item. /// </summary> public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions) { //FIXME: This code is *not* fully ported yet if (subItems.Count > 0) { throw new ApplicationException ("more than one level of edit actions don't make sense!"); } IEditAction editAction = (IEditAction) AddIn.CreateObject (Class); Gdk.Key[] actionKeys = new Gdk.Key[keys.Length]; for (int j = 0; j < keys.Length; ++j) { string[] keydescr = keys[j].Split (new char[] { '|' }); //Keys key = (Keys)((System.Windows.Forms.Keys.Space.GetType()).InvokeMember(keydescr[0], BindingFlags.GetField, null, System.Windows.Forms.Keys.Space, new object[0])); //Console.Write (keydescr[0] + " -- "); for (int k = 1; k < keydescr.Length; ++k) { //key |= (Keys)((System.Windows.Forms.Keys.Space.GetType()).InvokeMember(keydescr[k], BindingFlags.GetField, null, System.Windows.Forms.Keys.Space, new object[0])); //Console.Write (keydescr[k] + " -- "); } //actionKeys[j] = key; } editAction.Keys = actionKeys; return editAction; }
/// <summary> /// Creates an item with the specified sub items. And the current /// Condition status for this item. /// </summary> public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions) { // if (subItems == null || subItems.Count > 0) { // throw new ApplicationException("Tried to buil a command with sub commands, please check the XML definition."); // } Debug.Assert(Class != null && Class.Length > 0); languageBinding = (ILanguageBinding)AddIn.CreateObject(Class); return this; }
public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions) { ArrayList bs = new ArrayList (); foreach (object ob in subItems) { ContextPadCodon spad = ob as ContextPadCodon; if (spad != null) bs.Add (spad); } pads = (ContextPadCodon[]) bs.ToArray (typeof(ContextPadCodon)); return this; }
/// <summary> /// Creates an item with the specified sub items. And the current /// Condition status for this item. /// </summary> public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions) { IDialogPanelDescriptor newItem = null; if (subItems == null || subItems.Count == 0) { if (Class != null) { newItem = new DefaultDialogPanelDescriptor(ID, GettextCatalog.GetString (Label), (IDialogPanel)AddIn.CreateObject(Class)); } else { newItem = new DefaultDialogPanelDescriptor(ID, GettextCatalog.GetString (Label)); } } else { newItem = new DefaultDialogPanelDescriptor(ID, GettextCatalog.GetString (Label), subItems); } return newItem; }
//TextEditorControl control = null; //Gtk.MenuItem[] menuCommands = null; public Gtk.MenuItem[] BuildSubmenu(ConditionCollection conditionCollection, object owner) { /* control = (TextEditorControl)owner; ArrayList menuItems = new ArrayList(); foreach (DictionaryEntry entry in HighlightingManager.Manager.HighlightingDefinitions) { SdMenuCheckBox item = new SdMenuCheckBox(null, null, entry.Key.ToString()); item.Active = control.Document.HighlightingStrategy.Name == entry.Key.ToString(); item.Toggled += new EventHandler(ChangeSyntax); menuItems.Add(item); } menuCommands = (Gtk.MenuItem[])menuItems.ToArray(typeof(Gtk.MenuItem)); return menuCommands; */ return null; }
public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions) { ArrayList bs = new ArrayList (); ArrayList ops = new ArrayList (); foreach (object ob in subItems) { NodeBuilderCodon nbc = ob as NodeBuilderCodon; if (nbc != null) bs.Add (nbc.NodeBuilder); else { PadOptionCodon poc = ob as PadOptionCodon; if (poc != null) ops.Add (poc.Option); } } builders = (NodeBuilder[]) bs.ToArray (typeof(NodeBuilder)); options = (TreePadOption[]) ops.ToArray (typeof(TreePadOption)); return base.BuildItem (owner, subItems, conditions); }
public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions) { projectBinding = (IProjectBinding) AddIn.CreateObject (Class); return this; }
/// <summary> /// Creates an item with the specified sub items. And the current /// Condition status for this item. /// </summary> public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions) { Debug.Assert(Class != null && Class.Length > 0); return AddIn.CreateObject(Class); }
/// <summary> /// Creates an item with the specified sub items. And the current /// Condition status for this item. /// </summary> public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions) { if (subItems.Count > 0) { throw new ApplicationException("more than one level of icons don't make sense!"); } return this; }
public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions) { content = CreatePad (); return this; }
public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions) { builder = (NodeBuilder) AddIn.CreateObject (Class); if (builder == null) throw new ApplicationException ("Could not create object of type: " + Class); return this; }
ICondition GetCondition(XmlElement el) { ConditionCollection conditions = new ConditionCollection(); foreach (XmlElement child in el.ChildNodes) { conditions.Add(GetCondition(child)); } switch (el.Name) { case "Condition": if (conditions.Count > 0) { throw new AddInTreeFormatException("Condition node childs found. (doesn't make sense)"); } ICondition c = AddInTreeSingleton.AddInTree.ConditionFactory.CreateCondition(this, el); AutoInitializeAttributes(c, el); return c; case "And": if (conditions.Count <= 1) { throw new AddInTreeFormatException("And node with none or only one child found."); } return new AndCondition(conditions); case "Or": if (conditions.Count <= 1) { throw new AddInTreeFormatException("Or node with none or only one child found."); } return new OrCondition(conditions); case "Not": if (conditions.Count > 1) { throw new AddInTreeFormatException("Not node with more than one child found"); } if (conditions.Count == 0) { throw new AddInTreeFormatException("Not node without child found."); } return new NegatedCondition(conditions); } throw new AddInTreeFormatException("node " + el.Name + " not valid in expression."); }
public NegatedCondition(ConditionCollection conditions) { this.conditions = conditions; }
public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions) { fileFormat = (IFileFormat) AddIn.CreateObject (Class); return this; }
/// <summary> /// <para> /// Initializes a new instance of <see cref="ConditionCollection"/> based on another <see cref="ConditionCollection"/>. /// </para> /// </summary> /// <param name="value"> /// A <see cref="ConditionCollection"/> from which the contents are copied /// </param> public ConditionCollection(ConditionCollection value) { this.AddRange(value); }
public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions) { handler = (IExecutionHandler) AddIn.CreateObject (Class); return this; }
/// <summary> /// Creates a new instance. /// </summary> public IConditionEnumerator(ConditionCollection mappings) { this.temp = ((IEnumerable)(mappings)); this.baseEnumerator = temp.GetEnumerator(); }
/// <summary> /// <para> /// Adds the contents of another <see cref="ConditionCollection"/> to the end of the collection. /// </para> /// </summary> /// <param name="value"> /// A <see cref="ConditionCollection"/> containing the objects to add to the collection. /// </param> /// <returns> /// <para>None.</para> /// </returns> /// <seealso cref="ConditionCollection.Add"/> public void AddRange(ConditionCollection value) { for (int i = 0; (i < value.Count); i = (i + 1)) { this.Add(value[i]); } }
public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions) { object id = CommandCodon.ParseCommandId (this); return new CommandEntry (id); }
/// <summary> /// Creates an item with the specified sub items. And the current /// Condition status for this item. /// </summary> public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions) { this.subItems = subItems; enabled = false; //action != ConditionFailedAction.Disable; this.conditions = conditions; return this; }
public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions) { return new CommandEntry (Command.Separator); }
public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions) { option = new TreePadOption (ID, label, defaultValue); return this; }
// [XmlMemberAttribute("description")] // string description; public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions) { return new LinkCommandEntry (label, link, ResourceService.GetStockId ("md-web-search-icon")); }
// [XmlMemberAttribute ("defaultVisible")] // bool visible = true; public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions) { return this; }
void AddCodonsToExtension(Extension e, XmlElement el, ConditionCollection conditions) { foreach (object o in el.ChildNodes) { if (!(o is XmlElement)) { continue; } XmlElement curEl = (XmlElement)o; switch (curEl.Name) { case "And": // these nodes are silently ignored. case "Or": case "Not": case "Condition": break; case "Conditional": ICondition condition = null; // construct condition if (curEl.Attributes.Count == 0 || (curEl.Attributes.Count == 1 && curEl.Attributes["action"] != null)) { condition = BuildComplexCondition(curEl); // set condition action manually if (curEl.Attributes["action"] != null) { condition.Action = (ConditionFailedAction)Enum.Parse(typeof(ConditionFailedAction), curEl.Attributes["action"].InnerText); } if (condition == null) { throw new AddInTreeFormatException("empty conditional, but no condition definition found."); } } else { condition = AddInTreeSingleton.AddInTree.ConditionFactory.CreateCondition(this, curEl); AutoInitializeAttributes(condition, curEl); } // put the condition at the end of the condition 'stack' conditions.Add(condition); // traverse the subtree AddCodonsToExtension(e, curEl, conditions); // now we are back to the old level, remove the condition // that was applied to the subtree. conditions.RemoveAt(conditions.Count - 1); break; default: ICodon codon = AddInTreeSingleton.AddInTree.CodonFactory.CreateCodon(this, curEl); AutoInitializeAttributes(codon, curEl); // Ensure that the codon is inserted after the codon which is defined // before in the add-in definition. // The codons get topologically sorted and if I don't set the InsertAfter they may // change it's sorting order. e.Conditions[codon.ID] = new ConditionCollection(conditions); if (codon.InsertAfter == null && codon.InsertBefore == null && e.CodonCollection.Count > 0) { codon.InsertAfter = new string[] { ((ICodon)e.CodonCollection[e.CodonCollection.Count - 1]).ID }; } e.CodonCollection.Add(codon); if (curEl.ChildNodes.Count > 0) { Extension newExtension = new Extension(e.Path + '/' + codon.ID); AddCodonsToExtension(newExtension, curEl, conditions); extensions.Add(newExtension); } break; } } }
public OrCondition(ConditionCollection conditions) { this.conditions = conditions; }
public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions) { Command cmd = (Command) base.BuildItem (owner, subItems, conditions); return new LocalCommandEntry (cmd); }
public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions) { ActionType ct = ActionType.Normal; bool isArray = false; bool custom = false; bool isAction = false; foreach (string p in type.Split ('|')) { switch (p) { case "check": ct = ActionType.Check; if (isAction) throw new InvalidOperationException ("Action type specified twice."); isAction = true; break; case "radio": ct = ActionType.Radio; if (isAction) throw new InvalidOperationException ("Action type specified twice."); isAction = true; break; case "normal": ct = ActionType.Normal; if (isAction) throw new InvalidOperationException ("Action type specified twice."); isAction = true; break; case "custom": if (widget == null) throw new InvalidOperationException ("Widget type not specified in custom command."); custom = true; break; case "array": isArray = true; break; default: throw new InvalidOperationException ("Unknown command type: " + p); } } if (isAction && custom) throw new InvalidOperationException ("Invalid command type combination: " + type); Command cmd; if (custom) { if (isArray) throw new InvalidOperationException ("Array custom commands are not allowed."); CustomCommand ccmd = new CustomCommand (); ccmd.Text = label; ccmd.Description = description; ccmd.WidgetType = AddIn.GetType (widget); if (ccmd.WidgetType == null) throw new InvalidOperationException ("Could not find command type '" + widget + "'."); cmd = ccmd; } else { if (widget != null) throw new InvalidOperationException ("Widget type can only be specified for custom commands."); ActionCommand acmd = new ActionCommand (); acmd.ActionType = ct; acmd.CommandArray = isArray; if (defaultHandler != null) { acmd.DefaultHandlerType = AddIn.GetType (defaultHandler); if (acmd.DefaultHandlerType == null) throw new InvalidOperationException ("Could not find handler type '" + defaultHandler + "' for command " + ID); } cmd = acmd; } cmd.Id = ParseCommandId (this); cmd.Text = Runtime.StringParserService.Parse (GettextCatalog.GetString (label)); cmd.Description = GettextCatalog.GetString (description); if (icon != null) cmd.Icon = ResourceService.GetStockId (AddIn, icon); cmd.AccelKey = shortcut; cmd.DisabledVisible = disabledVisible; return cmd; }
/// <summary> /// Creates an item with the specified sub items and the current /// Conditions for this item. /// </summary> public abstract object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions);