public void UpdateASCompletion(IMainForm mainForm, Project project) { List <string> classPaths = new List <string>(); List <string> hiddenPaths = new List <string>(); string version; string platform = ""; if (project != null) { BuildActions.GetCompilerPath(project); // refresh project's SDK project.UpdateVars(true); // platform/version platform = project.MovieOptions.Platform; version = project.MovieOptions.Version; if (platform != PlatformData.FLASHPLAYER_PLATFORM && project.MovieOptions.HasPlatformSupport && project.MovieOptions.PlatformSupport.IsFlashPlatform) { version = PlatformData.ResolveFlashPlayerVersion(project.Language, platform, version); } // add project classpaths foreach (string cp in project.AbsoluteClasspaths) { if (Directory.Exists(cp)) { classPaths.Add(cp); } } // add AS3 libraries string absPath; if (project is AS3Project) { MxmlcOptions options = (project as AS3Project).CompilerOptions; foreach (string relPath in options.IntrinsicPaths) { absPath = PathHelper.ResolvePath(relPath); if (absPath == null) { absPath = project.GetAbsolutePath(relPath); } if (absPath == null) { continue; } if (Directory.Exists(absPath)) { classPaths.Add(absPath); } } foreach (string relPath in options.LibraryPaths) { absPath = project.GetAbsolutePath(relPath); if (absPath == null) { continue; } if (File.Exists(absPath)) { classPaths.Add(absPath); } else if (Directory.Exists(absPath)) { string[] libs = Directory.GetFiles(absPath, "*.swc"); foreach (string lib in libs) { classPaths.Add(lib); } } } foreach (string relPath in options.IncludeLibraries) { absPath = project.GetAbsolutePath(relPath); if (absPath == null) { continue; } if (Directory.Exists(absPath) || File.Exists(absPath)) { classPaths.Add(absPath); } } foreach (string relPath in options.ExternalLibraryPaths) { absPath = project.GetAbsolutePath(relPath); if (absPath == null) { continue; } if (Directory.Exists(absPath) || File.Exists(absPath)) { classPaths.Add(absPath); } } foreach (string relPath in options.RSLPaths) { string[] parts = relPath.Split(','); if (parts.Length < 2) { continue; } absPath = project.GetAbsolutePath(relPath); if (absPath == null) { continue; } if (File.Exists(absPath)) { classPaths.Add(absPath); } } } string dir = project.Directory; foreach (string hidPath in project.HiddenPaths) { absPath = Path.Combine(dir, hidPath); foreach (string cp in classPaths) { if (absPath.StartsWithOrdinal(cp)) { hiddenPaths.Add(absPath); break; } } } } else if (PlatformData.SupportedLanguages.ContainsKey("as3")) { var targets = PlatformData.SupportedLanguages["as3"].Platforms; var flashPlatform = targets[PlatformData.FLASHPLAYER_PLATFORM]; version = flashPlatform.LastVersion.Value; } else { version = "11.0"; } DataEvent de; Hashtable info = new Hashtable(); // release old classpath if (currentLang != null && project == null) { info["lang"] = currentLang; info["platform"] = ""; info["targetBuild"] = ""; info["version"] = "0.0"; info["classpath"] = null; info["hidden"] = null; de = new DataEvent(EventType.Command, "ASCompletion.ClassPath", info); EventManager.DispatchEvent(this, de); } // set new classpath if (project != null) { currentLang = project.Language; info["platform"] = platform; info["version"] = version; info["targetBuild"] = project.TargetBuild; info["lang"] = currentLang; info["classpath"] = classPaths.ToArray(); info["hidden"] = hiddenPaths.ToArray(); de = new DataEvent(EventType.Command, "ASCompletion.ClassPath", info); EventManager.DispatchEvent(this, de); project.AdditionalPaths = info.ContainsKey("additional") ? info["additional"] as string[] : null; } else { currentLang = null; } }
public void Initialize() { LoadSettings(); pluginImage = MainForm.FindImage("100"); pluginDesc = TextHelper.GetString("Info.Description"); openFileQueue = new Queue<String>(); Icons.Initialize(MainForm); EventManager.AddEventHandler(this, eventMask); showProjectClasspaths = Settings.ShowProjectClasspaths; showGlobalClasspaths = Settings.ShowGlobalClasspaths; #region Actions and Event Listeners menus = new FDMenus(MainForm); menus.ProjectMenu.ProjectItemsEnabled = false; menus.TestMovie.Enabled = false; menus.TestMovie.Click += delegate { TestMovie(); }; menus.BuildProject.Enabled = false; menus.BuildProject.Click += delegate { BuildProject(); }; menus.View.Click += delegate { OpenPanel(); }; menus.GlobalClasspaths.Click += delegate { OpenGlobalClasspaths(); }; menus.ConfigurationSelector.SelectedIndexChanged += delegate { bool isDebug = menus.ConfigurationSelector.Text == TextHelper.GetString("Info.Debug"); FlexCompilerShell.Cleanup(); pluginUI.IsTraceDisabled = !isDebug; Project project = activeProject; if (project != null) project.TraceEnabled = isDebug; }; menus.TargetBuildSelector.KeyDown += new KeyEventHandler(TargetBuildSelector_KeyDown); menus.TargetBuildSelector.SelectedIndexChanged += delegate { ApplyTargetBuild(); }; menus.TargetBuildSelector.LostFocus += delegate { ApplyTargetBuild(); }; menus.ProjectMenu.NewProject.Click += delegate { NewProject(); }; menus.ProjectMenu.OpenProject.Click += delegate { OpenProject(); }; menus.ProjectMenu.ImportProject.Click += delegate { ImportProject(); }; menus.ProjectMenu.CloseProject.Click += delegate { CloseProject(false); }; menus.ProjectMenu.OpenResource.Click += delegate { OpenResource(); }; menus.ProjectMenu.TestMovie.Click += delegate { TestMovie(); }; menus.ProjectMenu.RunProject.Click += delegate { RunProject(); }; menus.ProjectMenu.BuildProject.Click += delegate { BuildProject(); }; menus.ProjectMenu.CleanProject.Click += delegate { CleanProject(); }; menus.ProjectMenu.Properties.Click += delegate { OpenProjectProperties(); }; menus.RecentProjects.ProjectSelected += delegate(string projectPath) { OpenProjectSilent(projectPath); }; buildActions = new BuildActions(MainForm,menus); buildActions.BuildComplete += BuildComplete; buildActions.BuildFailed += BuildFailed; flashDevelopActions = new FlashDevelopActions(MainForm); fileActions = new FileActions(MainForm,flashDevelopActions); fileActions.OpenFile += OpenFile; fileActions.FileDeleted += FileDeleted; fileActions.FileMoved += FileMoved; fileActions.FileCopied += FilePasted; projectActions = new ProjectActions(pluginUI); pluginUI = new PluginUI(this, menus, fileActions, projectActions); pluginUI.NewProject += delegate { NewProject(); }; pluginUI.OpenProject += delegate { OpenProject(); }; pluginUI.ImportProject += delegate { ImportProject(); }; pluginUI.Rename += fileActions.Rename; pluginUI.TreeBar.ShowHidden.Click += delegate { ToggleShowHidden(); }; pluginUI.TreeBar.Synchronize.Click += delegate { TreeSyncToCurrentFile(); }; pluginUI.TreeBar.SynchronizeMain.Click += delegate { TreeSyncToMainFile(); }; pluginUI.TreeBar.ProjectProperties.Click += delegate { OpenProjectProperties(); }; pluginUI.TreeBar.RefreshSelected.Click += delegate { TreeRefreshSelectedNode(); }; pluginUI.TreeBar.ProjectTypes.Click += delegate { DataEvent de = new DataEvent(EventType.Command, "ASCompletion.TypesExplorer", null); EventManager.DispatchEvent(this, de); }; pluginUI.Menu.Open.Click += delegate { TreeOpenItems(); }; pluginUI.Menu.Execute.Click += delegate { TreeExecuteItems(); }; pluginUI.Menu.Insert.Click += delegate { TreeInsertItem(); }; pluginUI.Menu.AddLibrary.Click += delegate { TreeAddLibraryItems(); }; pluginUI.Menu.AlwaysCompile.Click += delegate { TreeAlwaysCompileItems(); }; pluginUI.Menu.SetDocumentClass.Click += delegate { TreeDocumentClass(); }; pluginUI.Menu.DocumentClass.Click += delegate { TreeDocumentClass(); }; pluginUI.Menu.Browse.Click += delegate { TreeBrowseItem(); }; pluginUI.Menu.Cut.Click += delegate { TreeCutItems(); }; pluginUI.Menu.Copy.Click += delegate { TreeCopyItems(); }; pluginUI.Menu.Paste.Click += delegate { TreePasteItems(); }; pluginUI.Menu.Delete.Click += delegate { TreeDeleteItems(); }; pluginUI.Menu.LibraryOptions.Click += delegate { TreeLibraryOptions(); }; pluginUI.Menu.HideItem.Click += delegate { TreeHideItems(); }; pluginUI.Menu.ShowHidden.Click += delegate { ToggleShowHidden(); }; pluginUI.Menu.AddFileFromTemplate += TreeAddFileFromTemplate; pluginUI.Menu.AddNewFolder.Click += delegate { TreeAddFolder(); }; pluginUI.Menu.AddLibraryAsset.Click += delegate { TreeAddAsset(); }; pluginUI.Menu.AddExistingFile.Click += delegate { TreeAddExistingFile(); }; pluginUI.Menu.TestMovie.Click += delegate { TestMovie(); }; pluginUI.Menu.BuildProject.Click += delegate { BuildProject(); }; pluginUI.Menu.CloseProject.Click += delegate { CloseProject(false); }; pluginUI.Menu.Properties.Click += delegate { OpenProjectProperties(); }; pluginUI.Menu.ShellMenu.Click += delegate { TreeShowShellMenu(); }; pluginUI.Menu.CommandPrompt.Click += delegate { TreeShowCommandPrompt(); }; pluginUI.Menu.BuildProjectFile.Click += delegate { BackgroundBuild(); }; pluginUI.Menu.BuildProjectFiles.Click += delegate { BackgroundBuild(); }; pluginUI.Menu.BuildAllProjects.Click += delegate { FullBuild(); }; pluginUI.Menu.TestAllProjects.Click += delegate { TestBuild(); }; pluginUI.Menu.FindAndReplace.Click += delegate { FindAndReplace(); }; pluginUI.Menu.FindInFiles.Click += delegate { FindInFiles(); }; pluginUI.Menu.CopyClassName.Click += delegate { CopyClassName(); }; pluginUI.Menu.AddSourcePath.Click += delegate { AddSourcePath(); }; pluginUI.Menu.RemoveSourcePath.Click += delegate { RemoveSourcePath(); }; pluginUI.Menu.Opening += new CancelEventHandler(this.MenuOpening); Tree.MovePath += fileActions.Move; Tree.CopyPath += fileActions.Copy; Tree.DoubleClick += delegate { TreeDoubleClick(); }; #endregion pluginPanel = MainForm.CreateDockablePanel(pluginUI, Guid, Icons.Project.Img, DockState.DockRight); buildQueue = new Queue<String>(); buildTimer = new Timer(); buildTimer.Interval = 500; buildTimer.Tick += new EventHandler(OnBuildTimerTick); buildingAll = false; runOutput = false; }
public void UpdateASCompletion(IMainForm mainForm, Project project) { List <string> classPaths = new List <string>(); List <string> hiddenPaths = new List <string>(); int majorVersion = 0; int minorVersion = 0; string platform = ""; if (project != null) { BuildActions.GetCompilerPath(project); // refresh project's SDK project.UpdateVars(true); // platform/version platform = project.MovieOptions.Platform; majorVersion = project.MovieOptions.MajorVersion; minorVersion = project.MovieOptions.MinorVersion; if (project.MovieOptions.Platform == AS3MovieOptions.AIR_PLATFORM || project.MovieOptions.Platform == AS3MovieOptions.AIR_MOBILE_PLATFORM) { PlatformData.GuessFlashPlayerForAIR(ref majorVersion, ref minorVersion); } // add project classpaths foreach (string cp in project.AbsoluteClasspaths) { if (Directory.Exists(cp)) { classPaths.Add(cp); } } // add AS3 libraries string absPath; if (project is AS3Project) { MxmlcOptions options = (project as AS3Project).CompilerOptions; foreach (string relPath in options.IntrinsicPaths) { absPath = PathHelper.ResolvePath(relPath); if (absPath == null) { absPath = project.GetAbsolutePath(relPath); } if (absPath == null) { continue; } if (Directory.Exists(absPath)) { classPaths.Add(absPath); } } foreach (string relPath in options.LibraryPaths) { absPath = project.GetAbsolutePath(relPath); if (absPath == null) { continue; } if (File.Exists(absPath)) { classPaths.Add(absPath); } else if (Directory.Exists(absPath)) { string[] libs = Directory.GetFiles(absPath, "*.swc"); foreach (string lib in libs) { classPaths.Add(lib); } } } foreach (string relPath in options.IncludeLibraries) { absPath = project.GetAbsolutePath(relPath); if (absPath == null) { continue; } if (Directory.Exists(absPath) || File.Exists(absPath)) { classPaths.Add(absPath); } } foreach (string relPath in options.ExternalLibraryPaths) { absPath = project.GetAbsolutePath(relPath); if (absPath == null) { continue; } if (Directory.Exists(absPath) || File.Exists(absPath)) { classPaths.Add(absPath); } } foreach (string relPath in options.RSLPaths) { string[] parts = relPath.Split(','); if (parts.Length < 2) { continue; } absPath = project.GetAbsolutePath(relPath); if (absPath == null) { continue; } if (File.Exists(absPath)) { classPaths.Add(absPath); } } } string dir = project.Directory; foreach (string hidPath in project.HiddenPaths) { absPath = Path.Combine(dir, hidPath); foreach (string cp in classPaths) { if (absPath.StartsWith(cp)) { hiddenPaths.Add(absPath); break; } } } } DataEvent de; Hashtable info = new Hashtable(); // release old classpath if (currentLang != null && project == null) { info["lang"] = currentLang; info["platform"] = ""; info["targetBuild"] = ""; info["version"] = "0.0"; info["classpath"] = null; info["hidden"] = null; de = new DataEvent(EventType.Command, "ASCompletion.ClassPath", info); EventManager.DispatchEvent(this, de); } // set new classpath if (project != null) { currentLang = project.Language; info["platform"] = platform; info["version"] = majorVersion + "." + minorVersion; info["targetBuild"] = project.TargetBuild; info["lang"] = currentLang; info["classpath"] = classPaths.ToArray(); info["hidden"] = hiddenPaths.ToArray(); de = new DataEvent(EventType.Command, "ASCompletion.ClassPath", info); EventManager.DispatchEvent(this, de); project.AdditionalPaths = info.ContainsKey("additional") ? info["additional"] as string[] : null; } else { currentLang = null; } }