public Event(Plugin plugin) { if (plugin.Type != PluginType.Event) { throw new ArgumentException("Plugin is not an event"); } this.plugin = plugin; foreach (PluginProperty property in plugin.Properties) { AddProperty(new Property(property)); } header = new Header(Plugin.Header, Properties, true); AddStatementCommand = new DelegateCommand(null, (parameter) => { var statement = parameter as AbstractStatement; if (null == statement) { var factory = parameter as StatementFactory; if (null != factory) { statement = factory.CreateStatement(); } } if (null != statement) { int oldIdx = -1; var oldParent = statement.Scope; if (null != oldParent) { oldIdx = oldParent.IndexOf(statement); } AddStatement(statement); Workspace.Instance.CommandHistory.Log( "insert/move statement", () => AddStatement(statement), () => { statement.RemoveFromParent(); if (null != oldParent) { oldParent.InsertAt(oldIdx, statement); } } ); } }); AddDependency<ScopeChanged>("Type"); }
public ReadOnlyEvent(AbstractEvent inheritedEvent) : base(inheritedEvent) { this.inheritedEvent = inheritedEvent; foreach (AbstractProperty inheritedProperty in inheritedEvent.Properties) { ReadOnlyProperty localProperty = new ReadOnlyProperty(inheritedProperty); AddProperty(localProperty); } header = new Header(Plugin.Header, Properties, false); }
public ReadOnlyAction(AbstractAction inheritedAction) : base(inheritedAction) { this.inheritedAction = inheritedAction; foreach (AbstractProperty inheritedProperty in inheritedAction.Properties) { ReadOnlyProperty localProperty = new ReadOnlyProperty(inheritedProperty); AddProperty(localProperty); } header = new Header(Plugin.Header, Properties, false); }
public Action(Plugin plugin) { if (plugin.Type != PluginType.Action) { throw new ArgumentException("Plugin is not an action"); } this.plugin = plugin; foreach (PluginProperty property in plugin.Properties) { AddProperty(new Property(property)); } header = new Header(Plugin.Header, Properties, true); AddDependency<ScopeChanged>("Type"); }