public BuildEventDialog(Project project) { InitializeComponent(); InitializeLocalization(); this.FormGuid = "ada69d37-2ec0-4484-b113-72bfeab2f239"; this.Font = PluginCore.PluginBase.Settings.DefaultFont; this.project = project; this.vars = new BuildEventVars(project); foreach (BuildEventInfo info in vars.GetVars()) Add(info); }
public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority priority) { TextEvent te = e as TextEvent; DataEvent de = e as DataEvent; Project project; switch (e.Type) { case EventType.UIStarted: // for some reason we have to do this on the next message loop for the tree // state to be restored properly. pluginUI.BeginInvoke((MethodInvoker)delegate { BroadcastMenuInfo(); BroadcastToolBarInfo(); OpenLastProject(); }); break; // replace $(SomeVariable) type stuff with things we know about case EventType.ProcessArgs: project = activeProject; // replace arguments using active project data if (!ProjectCreator.IsRunning) { if (project != null && te.Value.IndexOf('$') >= 0) { // steal macro names and values from the very useful BuildEvent macros BuildEventVars vars = new BuildEventVars(project); vars.AddVar("CompilerConfiguration", menus.ConfigurationSelector.Text); vars.AddVar("BuildIPC", buildActions.IPCName); foreach (BuildEventInfo info in vars.GetVars()) te.Value = te.Value.Replace(info.FormattedName, info.Value); // give the FileActions class an opportunity to process arguments // it may know about (if it was responsible for creating the file) te.Value = fileActions.ProcessArgs(project, te.Value); } else { BuildEventVars vars = new BuildEventVars(null); vars.AddVar("ProjectDir", PluginBase.MainForm.WorkingDirectory); foreach (BuildEventInfo info in vars.GetVars()) te.Value = te.Value.Replace(info.FormattedName, info.Value); } } break; case EventType.FileOpening: // if this is a project file, we can handle it ourselves if (FileInspector.IsProject(te.Value)) { te.Handled = true; OpenProjectSilent(te.Value); } else if (te.Value.EndsWith(".swf")) { te.Handled = true; OpenSwf(te.Value); } break; case EventType.FileOpen: SetDocumentIcon(MainForm.CurrentDocument); OpenNextFile(); // it's safe to open any other files on the queue break; case EventType.FileSave: // refresh the tree to update any included <mx:Script> tags string path = MainForm.CurrentDocument.FileName; if (Settings.EnableMxmlMapping && FileInspector.IsMxml(path, Path.GetExtension(path).ToLower()) && Tree.NodeMap.ContainsKey(path)) { Tree.RefreshNode(Tree.NodeMap[path]); } TabColors.UpdateTabColors(Settings); break; case EventType.FileSwitch: TabColors.UpdateTabColors(Settings); break; case EventType.ProcessStart: buildActions.NotifyBuildStarted(); break; case EventType.ProcessEnd: string result = te.Value; buildActions.NotifyBuildEnded(result); break; case EventType.ApplySettings: TabColors.UpdateTabColors(Settings); break; case EventType.Command: if (de.Action.StartsWith("ProjectManager.")) if (de.Action == ProjectManagerCommands.NewProject) { NewProject(); e.Handled = true; } else if (de.Action == ProjectManagerCommands.OpenProject) { if (de.Data != null && File.Exists((string)de.Data)) { OpenProjectSilent((string)de.Data); } else OpenProject(); e.Handled = true; } else if (de.Action == ProjectManagerCommands.SendProject) { BroadcastProjectInfo(activeProject); e.Handled = true; } else if (de.Action == ProjectManagerCommands.InstalledSDKsChanged) { project = activeProject; // TODO refresh SDK for all projects BuildActions.GetCompilerPath(project); // refresh project's SDK e.Handled = true; } else if (de.Action == ProjectManagerCommands.BuildProject) { if (Tree.Projects.Count > 0) { AutoSelectConfiguration((string)de.Data); BuildProject(); e.Handled = true; } } else if (de.Action == ProjectManagerCommands.TestMovie) { project = activeProject; // TODO we need a "runnable" project if (project != null) { AutoSelectConfiguration((string)de.Data); TestMovie(); e.Handled = true; } } else if (de.Action == ProjectManagerCommands.PlayOutput) { if (activeProject != null || de.Data != null) { OpenSwf((string)de.Data); de.Handled = true; } } else if (de.Action == ProjectManagerCommands.RestartFlexShell) { FlexCompilerShell.Cleanup(); } else if (de.Action == ProjectManagerCommands.SetConfiguration) { AutoSelectConfiguration((string)de.Data); } else if (de.Action == ProjectManagerCommands.HotBuild) { if (activeProject != null) { AutoSelectConfiguration((string)de.Data); TestMovie(); e.Handled = true; } } else if (de.Action == ProjectManagerCommands.RefreshTree) { TreeRefreshSelectedNode(); } else if (de.Action == ProjectManagerCommands.LineEntryDialog) { Hashtable info = (Hashtable)de.Data; LineEntryDialog askName = new LineEntryDialog((string)info["title"], (string)info["label"], (string)info["suggestion"]); DialogResult choice = askName.ShowDialog(); if (choice == DialogResult.OK && askName.Line.Trim().Length > 0 && askName.Line.Trim() != (string)info["suggestion"]) { info["suggestion"] = askName.Line.Trim(); } if (choice == DialogResult.OK) { e.Handled = true; } } break; case EventType.Keys: e.Handled = HandleKeyEvent(e as KeyEvent); break; } }
public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority priority) { TextEvent te = e as TextEvent; DataEvent de = e as DataEvent; switch (e.Type) { case EventType.UIStarted: // for some reason we have to do this on the next message loop for the tree // state to be restored properly. pluginUI.BeginInvoke((MethodInvoker)delegate { BroadcastMenuInfo(); OpenLastProject(); }); break; // replace $(SomeVariable) type stuff with things we know about case EventType.ProcessArgs: if (!ProjectCreator.IsRunning && project != null && te.Value.IndexOf('$') >= 0) { // steal macro names and values from the very useful BuildEvent macros BuildEventVars vars = new BuildEventVars(project); // this operation requires a message to ASCompletion so we don't add it to the BuildEventVars string cpath = BuildActions.GetCompilerPath(project); if (File.Exists(cpath)) cpath = Path.GetDirectoryName(cpath); if (project.Language == "as3") vars.AddVar("FlexSDK", cpath); vars.AddVar("CompilerPath", cpath); vars.AddVar("CompilerConfiguration", menus.ConfigurationSelector.Text); vars.AddVar("BuildConfiguration", pluginUI.IsTraceDisabled ? "release" : "debug"); vars.AddVar("BuildIPC", buildActions.IPCName); foreach (BuildEventInfo info in vars.GetVars()) te.Value = te.Value.Replace(info.FormattedName, info.Value); // give the FileActions class an opportunity to process arguments // it may know about (if it was responsible for creating the file) te.Value = fileActions.ProcessArgs(project, te.Value); } break; case EventType.FileOpening: // if this is a project file, we can handle it ourselves if (FileInspector.IsProject(te.Value)) { te.Handled = true; OpenProjectSilent(te.Value); } break; case EventType.FileOpen: SetDocumentIcon(MainForm.CurrentDocument); OpenNextFile(); // it's safe to open any other files on the queue break; case EventType.FileSave: // refresh the tree to update any included <mx:Script> tags string path = MainForm.CurrentDocument.FileName; if (Settings.EnableMxmlMapping && FileInspector.IsMxml(path, Path.GetExtension(path).ToLower()) && Tree.NodeMap.ContainsKey(path)) Tree.RefreshNode(Tree.NodeMap[path]); break; case EventType.ApplySettings: MainForm.IgnoredKeys.Add(Settings.ShortcutTestMovie); MainForm.IgnoredKeys.Add(Settings.ShortcutBuildProject); MainForm.IgnoredKeys.Add(Settings.ShortcutOpenResource); menus.ProjectMenu.OpenResource.ShortcutKeyDisplayString = DataConverter.KeysToString(Settings.ShortcutOpenResource); menus.ProjectMenu.BuildProject.ShortcutKeyDisplayString = DataConverter.KeysToString(Settings.ShortcutBuildProject); menus.ProjectMenu.TestMovie.ShortcutKeyDisplayString = DataConverter.KeysToString(Settings.ShortcutTestMovie); break; case EventType.ProcessStart: buildActions.NotifyBuildStarted(); break; case EventType.ProcessEnd: string result = te.Value; buildActions.NotifyBuildEnded(result); break; case EventType.Command: if (de.Action == ProjectManagerCommands.NewProject) { NewProject(); e.Handled = true; } else if (de.Action == ProjectManagerCommands.OpenProject) { if (de.Data != null && File.Exists((string)de.Data)) { projectActions.OpenProjectSilent((string)de.Data); } else OpenProject(); e.Handled = true; } else if (de.Action == ProjectManagerCommands.SendProject) { BroadcastProjectInfo(); e.Handled = true; } else if (de.Action == ProjectManagerCommands.BuildProject) { if (project != null) { AutoSelectConfiguration((string)de.Data); BuildProject(); e.Handled = true; } } else if (de.Action == ProjectManagerCommands.TestMovie) { if (project != null) { AutoSelectConfiguration((string)de.Data); TestMovie(); e.Handled = true; } } else if (de.Action == ProjectManagerCommands.PlayOutput) { OpenSwf((string)de.Data); } else if (de.Action == ProjectManagerCommands.RestartFlexShell) { FlexCompilerShell.Cleanup(); } else if (de.Action == ProjectManagerCommands.SetConfiguration) { AutoSelectConfiguration((string)de.Data); } else if (de.Action == "HotBuild") { if (project != null) { AutoSelectConfiguration((string)de.Data); TestMovie(); e.Handled = true; } } else if (de.Action == "LineEntryDialog") { Hashtable info = (Hashtable)de.Data; LineEntryDialog askName = new LineEntryDialog((string)info["title"], (string)info["label"], (string)info["suggestion"]); DialogResult choice = askName.ShowDialog(); if (choice == DialogResult.OK && askName.Line.Trim().Length > 0 && askName.Line.Trim() != (string)info["suggestion"]) { info["suggestion"] = askName.Line.Trim(); } if (choice == DialogResult.OK) { e.Handled = true; } } break; case EventType.Keys: e.Handled = HandleKeyEvent(e as KeyEvent); break; } }
public BuildEventDialog(Project project) { InitializeComponent(); InitializeLocalization(); this.FormGuid = "ada69d37-2ec0-4484-b113-72bfeab2f239"; this.Font = PluginCore.PluginBase.Settings.DefaultFont; this.project = project; this.vars = new BuildEventVars(project); // this operation requires a message to ASCompletion so we don't add it to the BuildEventVars string path = BuildActions.GetCompilerPath(project); if (File.Exists(path)) path = Path.GetDirectoryName(path); vars.AddVar("CompilerPath", path); foreach (BuildEventInfo info in vars.GetVars()) Add(info); }