public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority prority) { Project project; switch (e.Type) { case EventType.Command: DataEvent evt = (DataEvent)e; if (evt.Action == "ProjectManager.CreateNewFile") { Hashtable table = evt.Data as Hashtable; project = PluginBase.CurrentProject as Project; if ((project.Language.StartsWith("as")) && IsWizardTemplate(table["templatePath"] as String)) { evt.Handled = true; String className = table.ContainsKey("className") ? table["className"] as String : TextHelper.GetString("Wizard.Label.NewClass"); DisplayClassWizard(table["inDirectory"] as String, table["templatePath"] as String, className, table["constructorArgs"] as String, table["constructorArgTypes"] as List <String>); } } break; case EventType.FileSwitch: if (PluginBase.MainForm.CurrentDocument.FileName == processOnSwitch) { processOnSwitch = null; if (lastFileOptions == null || lastFileOptions.interfaces == null) { return; } foreach (String cname in lastFileOptions.interfaces) { ASContext.Context.CurrentModel.Check(); ClassModel inClass = ASContext.Context.CurrentModel.GetPublicClass(); ASGenerator.SetJobContext(null, cname, null, null); ASGenerator.GenerateJob(GeneratorJobType.ImplementInterface, null, inClass, null); } lastFileOptions = null; } break; case EventType.ProcessArgs: TextEvent te = e as TextEvent; project = PluginBase.CurrentProject as Project; if (lastFileFromTemplate != null && project != null && (project.Language.StartsWith("as"))) { te.Value = ProcessArgs(project, te.Value); } break; } }
public string Common(Visibility scope, string sourceText, ClassModel sourceClassModel, int memberPos, int parameterPos) { ASContext.Context.SetAs3Features(); var table = new Hashtable(); table["scope"] = scope; sci.Text = sourceText; sci.ConfigurationLanguage = "as3"; var inClass = sourceClassModel; var sourceMember = sourceClassModel.Members[memberPos]; ASGenerator.SetJobContext(null, null, sourceMember.Parameters[parameterPos], null); ASGenerator.GenerateJob(GeneratorJobType.FieldFromPatameter, sourceMember, inClass, null, table); return(sci.Text); }