private static void ExploreInBackground()
        {
            Thread.Sleep(toWait);
            toWait = 10;

            PathExplorer last = null;

            while (!stopExploration)
            {
                PathExplorer next = null;

                lock (waiting)
                {
                    if (waiting.Count > 0) next = waiting.Dequeue();
                    else explorerThread = null;

                    // we want to call these notifications after we've processed the above
                    // logic, so that the last PathExplorer's NotifyDone gets called after
                    // explorerThread is null so that IsWorking is false.
                    if (last != null && last.OnExplorationDone != null)
                    {
                        last.NotifyProgress(null, 0, 0);
                        last.NotifyDone(last.pathModel.Path);
                    }
                }

                if (next != null)
                    next.BackgroundRun();
                else
                    break;

                last = next;
            }
        }
Exemple #2
0
        private static void ExploreInBackground()
        {
            Thread.Sleep(toWait);
            toWait = 10;

            PathExplorer last = null;

            while (!stopExploration)
            {
                PathExplorer next = null;

                if (contextUpdating)
                {
                    Thread.Sleep(100);
                    continue;
                }

                lock (waiting)
                {
                    if (waiting.Count > 0)
                    {
                        next = waiting.Dequeue();
                    }
                    else
                    {
                        explorerThread = null;
                    }

                    // we want to call these notifications after we've processed the above
                    // logic, so that the last PathExplorer's NotifyDone gets called after
                    // explorerThread is null so that IsWorking is false.
                    if (last != null && last.OnExplorationDone != null)
                    {
                        last.NotifyProgress(null, 0, 0);
                        last.NotifyDone(last.pathModel.Path);
                    }
                }

                if (next != null)
                {
                    next.BackgroundRun();
                }
                else
                {
                    PluginBase.RunAsync(() =>
                    {
                        EventManager.DispatchEvent(last, new DataEvent(EventType.Command, "ASCompletion.PathExplorerFinished", null));
                    });
                    break;
                }


                last = next;
            }
        }
Exemple #3
0
 protected virtual bool ExplorePath(PathModel path)
 {
     // exploration
     if (path.IsTemporaryPath)
     {
         path.IsTemporaryPath = false;
         path.WasExplored = false;
     }
     if (Settings != null && path.IsValid && !path.WasExplored
         && (!Settings.LazyClasspathExploration || path.IsVirtual))
     {
         //TraceManager.Add("EXPLORE: " + path.Path);
         PathExplorer explorer = new PathExplorer(this, path);
         explorer.OnExplorationDone += new PathExplorer.ExplorationDoneHandler(RefreshContextCache);
         explorer.OnExplorationProgress += new PathExplorer.ExplorationProgressHandler(ExplorationProgress);
         explorer.UseCache = !CommonSettings.DisableCache;
         explorer.Run();
         return true;
     }
     else if (path.WasExplored && path.IsVirtual)
     {
         // restore metadatas
         ExploreVirtualPath(path);
     }
     return false;
 }
Exemple #4
0
 protected virtual void ManualExploration(PathModel path, IEnumerable<String> hideDirectories)
 {
     PathExplorer explorer = new PathExplorer(this, path);
     path.InUse = true;
     if (hideDirectories != null) explorer.HideDirectories(hideDirectories);
     explorer.OnExplorationDone += new PathExplorer.ExplorationDoneHandler(RefreshContextCache);
     explorer.OnExplorationProgress += new PathExplorer.ExplorationProgressHandler(ExplorationProgress);
     explorer.UseCache = !CommonSettings.DisableCache;
     explorer.Run();
 }
 private static void ExploreNext()
 {
     if (index >= config.Classpath.Length)
     {
         ForceMXNamespace();
         AddBuiltInTags();
         ExpandInheritance();
         BuildGroups();
         //AddBuiltInEvents(); // FD intrinsics now contain required information
         GenerateDeclarations();
         output.Close();
         log.Close();
         Console.WriteLine("Finished. Press Enter to continue.");
     }
     else
     {
         string path = config.Classpath[index++];
         Log("> " + path);
         pathModel = new PathModel(path, context);
         explorer = new PathExplorer(context, pathModel);
         explorer.Run();
         explorer.OnExplorationDone += new PathExplorer.ExplorationDoneHandler(explorer_OnExplorationDone);
     }
 }
Exemple #6
0
        /// <summary>
        /// Classpathes & classes cache initialisation
        /// </summary>
        public override void BuildClassPath()
        {
            ReleaseClasspath();
            started = true;
            if (hxsettings == null) throw new Exception("BuildClassPath() must be overridden");

            // external version definition
            // expected from project manager: "9;path;path..."
            flashVersion = hxsettings.DefaultFlashVersion;
            string exPath = externalClassPath ?? "";
            if (exPath.Length > 0)
            {
                try
                {
                    int p = exPath.IndexOf(';');
                    flashVersion = Convert.ToInt16(exPath.Substring(0, p));
                    exPath = exPath.Substring(p + 1).Trim();
                }
                catch { }
            }

            // NOTE: version > 10 for non-Flash platforms
            string lang = null;
            features.Directives = new List<string>();
            if (IsJavaScriptTarget) 
            {
                lang = "js";
                features.Directives.Add(lang);
            }
            else if (IsNekoTarget) 
            {
                lang = "neko";
                features.Directives.Add(lang);
            }
            else if (IsPhpTarget)
            {
                lang = "php";
                features.Directives.Add(lang);
            }
            else if (IsCppTarget)
            {
                lang = "cpp";
                features.Directives.Add(lang);
            }
            else
            {
                features.Directives.Add("flash");
                features.Directives.Add("flash" + flashVersion);
                lang = (flashVersion >= 9) ? "flash9" : "flash";
            }
            features.Directives.Add("true");

            //
            // Class pathes
            //
            classPath = new List<PathModel>();
            // haXe std
            if (hxsettings.HaXePath != null)
            {
                string haxeCP = Path.Combine(hxsettings.HaXePath, "std");
                if (Directory.Exists(haxeCP))
                {
                    PathModel std = PathModel.GetModel(haxeCP, this);
                    if (!std.WasExplored && !Settings.LazyClasspathExploration)
                    {
                        PathExplorer stdExplorer = new PathExplorer(this, std);
                        stdExplorer.HideDirectories(new string[] { "flash", "flash9", "js", "neko", "php", "cpp" });
                        stdExplorer.OnExplorationDone += new PathExplorer.ExplorationDoneHandler(RefreshContextCache);
                        stdExplorer.Run();
                    }
                    AddPath(std);

                    PathModel specific = PathModel.GetModel(Path.Combine(haxeCP, lang), this);
                    if (!specific.WasExplored && !Settings.LazyClasspathExploration)
                    {
                        PathExplorer speExplorer = new PathExplorer(this, specific);
                        speExplorer.OnExplorationDone += new PathExplorer.ExplorationDoneHandler(RefreshContextCache);
                        speExplorer.Run();
                    }
                    AddPath(specific);
                }
            }
            HaxeProject proj = PluginBase.CurrentProject as HaxeProject;

            // swf-libs
            if (IsFlashTarget && flashVersion >= 9 && proj != null )
            {
                foreach(LibraryAsset asset in proj.LibraryAssets)
                    if (asset.IsSwf)
                    {
                        string path = proj.GetAbsolutePath(asset.Path);
                        if (File.Exists(path)) AddPath(path);
                    }
                foreach( string p in proj.CompilerOptions.Additional )
                    if( p.IndexOf("-swf-lib ") == 0 ) {
                        string path = proj.GetAbsolutePath(p.Substring(9));
                        if (File.Exists(path)) AddPath(path);
                    }
            }

            // add haxe libraries
            if (proj != null)
            {
                foreach (string param in proj.BuildHXML(new string[0], "", false))
                    if (param.IndexOf("-lib ") == 0)
                        AddPath(LookupLibrary(param.Substring(5)));
            }


            // add external pathes
            List<PathModel> initCP = classPath;
            classPath = new List<PathModel>();
            string[] cpathes;
            if (exPath.Length > 0)
            {
                cpathes = exPath.Split(';');
                foreach (string cpath in cpathes) AddPath(cpath.Trim());
            }
            // add user pathes from settings
            if (settings.UserClasspath != null && settings.UserClasspath.Length > 0)
            {
                foreach (string cpath in settings.UserClasspath) AddPath(cpath.Trim());
            }
            // add initial pathes
            foreach (PathModel mpath in initCP) AddPath(mpath);

            // parse top-level elements
            InitTopLevelElements();
            if (cFile != null) UpdateTopLevelElements();

            // add current temporaty path
            if (temporaryPath != null)
            {
                string tempPath = temporaryPath;
                temporaryPath = null;
                SetTemporaryPath(tempPath);
            }
            FinalizeClasspath();
        }