コード例 #1
0
 public FlexJSProjectBuilder(AS3Project project, string compilerPath) : base(project, compilerPath)
 {
     this.project = project;
     mxmlcPath    = Path.Combine(compilerPath, "js", "lib", "mxmlc.jar");
     if (!File.Exists(mxmlcPath))
     {
         throw new Exception("Could not locate js\\lib\\mxmlc.jar in FlexJS SDK.");
     }
     jvmConfig = JvmConfigHelper.ReadConfig(compilerPath);
     if (jvmConfig.ContainsKey("java.args"))
     {
         var args = jvmConfig["java.args"];
         if (args.Trim().Length > 0)
         {
             jvmArgs = args;
         }
     }
 }
コード例 #2
0
ファイル: FdbWrapper.cs プロジェクト: xeronith/flashdevelop
        public void Run(string projectPath, string flexSDKPath)
        {
            flexSDKPath = PathHelper.ResolvePath(flexSDKPath, projectPath);
            if (flexSDKPath != null && Directory.Exists(flexSDKPath))
            {
                if (flexSDKPath.EndsWith("bin", StringComparison.OrdinalIgnoreCase))
                {
                    flexSDKPath = Path.GetDirectoryName(flexSDKPath);
                }
            }
            else
            {
                return;
            }

            Dictionary <string, string> jvmConfig = JvmConfigHelper.ReadConfig(flexSDKPath);

            if (process == null || process.HasExited)
            {
                Initialize(flexSDKPath, jvmConfig, projectPath);
            }
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        internal bool Start(bool alwaysStart)
        {
            if (!alwaysStart && !CheckCurrent())
            {
                return(false);
            }
            UpdateMenuState(DebuggerState.Starting);

            // load JVM.. only once
            if (!jvm_up)
            {
                try
                {
                    BridgeSetup bridgeSetup = null;
                    bridgeSetup = new BridgeSetup();

                    string flexSDKPath = null;
                    if (currentProject != null)
                    {
                        flexSDKPath = currentProject.CurrentSDK;
                    }
                    else
                    {
                        flexSDKPath = PathHelper.ResolvePath(PluginBase.MainForm.ProcessArgString("$(FlexSDK)"));
                    }

                    if (flexSDKPath != null && Directory.Exists(flexSDKPath))
                    {
                        Dictionary <string, string> jvmConfig = JvmConfigHelper.ReadConfig(flexSDKPath);
                        String javaHome = JvmConfigHelper.GetJavaHome(jvmConfig, flexSDKPath);
                        if (!String.IsNullOrEmpty(javaHome))
                        {
                            bridgeSetup.JavaHome = javaHome;
                        }
                    }

                    bridgeSetup.AddAllJarsClassPath(PathHelper.PluginDir);
                    bridgeSetup.AddAllJarsClassPath(Path.Combine(PathHelper.ToolDir, @"flexlibs\lib"));
                    Bridge.CreateJVM(bridgeSetup);
                    Bridge.RegisterAssembly(typeof(IProgress).Assembly); // ??
                    Bridge.RegisterAssembly(typeof(Bootstrap).Assembly);
                    jvm_up = true;
                }
                catch (Exception ex)
                {
                    String msg = "Debugger startup error. For troubleshooting see: http://www.flashdevelop.org/wikidocs/index.php?title=F.A.Q\n";
                    TraceManager.Add(msg + "Error details: " + ex.ToString());
                    return(false);
                }
            }

            PluginBase.MainForm.ProgressBar.Visible   = true;
            PluginBase.MainForm.ProgressLabel.Visible = true;
            PluginBase.MainForm.ProgressLabel.Text    = TextHelper.GetString("Info.WaitingForPlayer");
            if (bgWorker == null || !bgWorker.IsBusy)
            {
                // only run a debugger if one is not already runnin - need to redesign core to support multiple debugging instances
                // other option: detach old worker, wait for it to exit and start new one
                bgWorker         = new BackgroundWorker();
                bgWorker.DoWork += bgWorker_DoWork;
                bgWorker.RunWorkerAsync();
            }
            return(true);
        }
コード例 #4
0
        public void RunMxmlc(string cmd, string flexPath)
        {
            if (running)
            {
                return;
            }
            string basePath = null;

            if (PluginBase.CurrentProject != null)
            {
                basePath = Path.GetDirectoryName(PluginBase.CurrentProject.ProjectPath);
            }
            flexPath = PathHelper.ResolvePath(flexPath, basePath);

            if (flexPath != null && Directory.Exists(flexPath))
            {
                if (flexPath.EndsWith("bin", StringComparison.OrdinalIgnoreCase))
                {
                    flexPath = Path.GetDirectoryName(flexPath);
                }
                mxmlcPath = Path.Combine(Path.Combine(flexPath, "lib"), "mxmlc.jar");
            }
            if (mxmlcPath == null || !File.Exists(mxmlcPath))
            {
                DialogResult result = MessageBox.Show(TextHelper.GetString("Info.OpenCompilerSettings"), TextHelper.GetString("Title.ConfigurationRequired"), MessageBoxButtons.OKCancel);
                if (result == DialogResult.OK)
                {
                    IASContext context = ASContext.GetLanguageContext("as3");
                    if (context == null)
                    {
                        return;
                    }
                    PluginBase.MainForm.ShowSettingsDialog("AS3Context", "SDK");
                }
                return;
            }

            flexShellsPath = CheckResource("FlexShells.jar", flexShellsJar);
            if (!File.Exists(flexShellsPath))
            {
                ErrorManager.ShowInfo(TextHelper.GetString("Info.ResourceError"));
                return;
            }

            jvmConfig = JvmConfigHelper.ReadConfig(Path.Combine(flexPath, "bin\\jvm.config"));

            try
            {
                running = true;
                EventManager.DispatchEvent(this, new NotifyEvent(EventType.ProcessStart));

                if (mxmlcRunner == null || !mxmlcRunner.IsRunning)
                {
                    StartMxmlcRunner(flexPath);
                }

                //cmd = mainForm.ProcessArgString(cmd);
                //TraceManager.Add("MxmlcShell command: "+cmd, -1);

                ASContext.SetStatusText(TextHelper.GetString("Info.MxmlcRunning"));
                notificationSent = false;
                mxmlcRunner.HostedProcess.StandardInput.WriteLine(cmd);
            }
            catch (Exception ex)
            {
                ErrorManager.ShowError(ex);
            }
        }
コード例 #5
0
        public void CheckAS3(string filename, string flexPath, string src)
        {
            if (running || filename.EndsWith(".mxml"))
            {
                return;
            }
            string basePath = null;

            if (PluginBase.CurrentProject != null)
            {
                basePath = Path.GetDirectoryName(PluginBase.CurrentProject.ProjectPath);
            }
            flexPath = PathHelper.ResolvePath(flexPath, basePath);
            // asc.jar in Flex2SDK
            if (flexPath != null && Directory.Exists(flexPath))
            {
                if (flexPath.EndsWith("bin", StringComparison.OrdinalIgnoreCase))
                {
                    flexPath = Path.GetDirectoryName(flexPath);
                }
                ascPath = Path.Combine(flexPath, "lib\\asc.jar");
            }
            // asc_authoring.jar in Flash CS3
            if (ascPath == null)
            {
                ascPath = FindAscAuthoring();
            }

            if (ascPath == null)
            {
                if (src != null)
                {
                    return;              // silent checking
                }
                DialogResult result = MessageBox.Show(TextHelper.GetString("Info.SetFlex2OrCS3Path"), TextHelper.GetString("Title.ConfigurationRequired"), MessageBoxButtons.YesNoCancel);
                if (result == DialogResult.Yes)
                {
                    IASContext context = ASContext.GetLanguageContext("as3");
                    if (context == null)
                    {
                        return;
                    }
                    PluginBase.MainForm.ShowSettingsDialog("AS3Context", "SDK");
                }
                else if (result == DialogResult.No)
                {
                    PluginBase.MainForm.ShowSettingsDialog("ASCompletion", "Flash");
                }
                return;
            }

            flexShellsPath = CheckResource("FlexShells.jar", flexShellsJar);
            if (!File.Exists(flexShellsPath))
            {
                if (src != null)
                {
                    return;              // silent checking
                }
                ErrorManager.ShowInfo(TextHelper.GetString("Info.ResourceError"));
                return;
            }

            jvmConfig = JvmConfigHelper.ReadConfig(Path.Combine(flexPath ?? "", "bin\\jvm.config"));

            try
            {
                running = true;
                if (src == null)
                {
                    EventManager.DispatchEvent(this, new NotifyEvent(EventType.ProcessStart));
                }
                if (ascRunner == null || !ascRunner.IsRunning)
                {
                    StartAscRunner();
                }

                notificationSent = false;
                if (src == null)
                {
                    silentChecking = false;
                    //TraceManager.Add("Checking: " + filename, -1);
                    ASContext.SetStatusText(TextHelper.GetString("Info.AscRunning"));
                    ascRunner.HostedProcess.StandardInput.WriteLine(filename);
                }
                else
                {
                    silentChecking = true;
                    ascRunner.HostedProcess.StandardInput.WriteLine(filename + "$raw$");
                    ascRunner.HostedProcess.StandardInput.WriteLine(src);
                    ascRunner.HostedProcess.StandardInput.WriteLine(filename + "$raw$");
                }
            }
            catch (Exception ex)
            {
                ErrorManager.ShowError(TextHelper.GetString("Info.CheckError"), ex);
            }
        }
コード例 #6
0
        public void CheckAS3(string filename, string flexPath, string src)
        {
            if (running)
            {
                return;
            }

            // let other plugins preprocess source/handle checking
            Hashtable data = new Hashtable();

            data["filename"] = filename;
            data["src"]      = src;
            data["ext"]      = Path.GetExtension(filename);
            DataEvent de = new DataEvent(EventType.Command, "AS3Context.CheckSyntax", data);

            EventManager.DispatchEvent(this, de);
            if (de.Handled)
            {
                return;
            }

            src      = (string)data["src"];
            filename = (string)data["filename"];
            if (".mxml" == (string)data["ext"]) // MXML not supported by ASC without preprocessing
            {
                return;
            }

            string basePath = null;

            if (PluginBase.CurrentProject != null)
            {
                basePath = Path.GetDirectoryName(PluginBase.CurrentProject.ProjectPath);
            }
            flexPath = PathHelper.ResolvePath(flexPath, basePath);
            // asc.jar in FlexSDK
            if (flexPath != null && Directory.Exists(Path.Combine(flexPath, "lib")))
            {
                ascPath = Path.Combine(flexPath, "lib\\asc.jar");
            }
            // included asc.jar
            if (ascPath == null || !File.Exists(ascPath))
            {
                ascPath = PathHelper.ResolvePath(Path.Combine(PathHelper.ToolDir, "flexlibs/lib/asc.jar"));
            }

            if (ascPath == null)
            {
                if (src != null)
                {
                    return;              // silent checking
                }
                DialogResult result = MessageBox.Show(TextHelper.GetString("Info.SetFlex2OrCS3Path"), TextHelper.GetString("Title.ConfigurationRequired"), MessageBoxButtons.YesNoCancel);
                if (result == DialogResult.Yes)
                {
                    IASContext context = ASContext.GetLanguageContext("as3");
                    if (context == null)
                    {
                        return;
                    }
                    PluginBase.MainForm.ShowSettingsDialog("AS3Context", "SDK");
                }
                else if (result == DialogResult.No)
                {
                    PluginBase.MainForm.ShowSettingsDialog("ASCompletion", "Flash");
                }
                return;
            }

            flexShellsPath = CheckResource("FlexShells.jar", flexShellsJar);
            if (!File.Exists(flexShellsPath))
            {
                if (src != null)
                {
                    return;              // silent checking
                }
                ErrorManager.ShowInfo(TextHelper.GetString("Info.ResourceError"));
                return;
            }

            jvmConfig = JvmConfigHelper.ReadConfig(flexPath);

            try
            {
                running = true;
                if (src == null)
                {
                    EventManager.DispatchEvent(this, new NotifyEvent(EventType.ProcessStart));
                }
                if (ascRunner == null || !ascRunner.IsRunning || currentSDK != flexPath)
                {
                    StartAscRunner(flexPath);
                }

                notificationSent = false;
                if (src == null)
                {
                    silentChecking = false;
                    //TraceManager.Add("Checking: " + filename, -1);
                    ASContext.SetStatusText(TextHelper.GetString("Info.AscRunning"));
                    ascRunner.HostedProcess.StandardInput.WriteLine(filename);
                }
                else
                {
                    silentChecking = true;
                    ascRunner.HostedProcess.StandardInput.WriteLine(filename + "$raw$");
                    ascRunner.HostedProcess.StandardInput.WriteLine(src);
                    ascRunner.HostedProcess.StandardInput.WriteLine(filename + "$raw$");
                }
            }
            catch (Exception ex)
            {
                ErrorManager.AddToLog(TextHelper.GetString("Info.CheckError"), ex);
                TraceManager.AddAsync(TextHelper.GetString("Info.CheckError") + "\n" + ex.Message);
            }
        }