Example #1
0
        public PluginUI(PluginMain plugin)
        {
            settings = plugin.PluginSettings;
            SuspendLayout();
            InitializeControls();
            InitializeTexts();
            ResumeLayout();

            highlightTimer          = new Timer();
            highlightTimer.Interval = 200;
            highlightTimer.Tick    += new EventHandler(highlightTimer_Tick);
        }
        /// <summary>
        /// Init completion engine context
        /// </summary>
        /// <param name="mainForm">Reference to MainForm</param>
        static public void Init(PluginMain pluginMain)
        {
            dirSeparatorChar    = System.IO.Path.DirectorySeparatorChar;
            dirSeparator        = dirSeparatorChar.ToString();
            dirAltSeparatorChar = System.IO.Path.AltDirectorySeparatorChar;
            dirAltSeparator     = dirAltSeparatorChar.ToString();
            doPathNormalization = dirSeparator != dirAltSeparator;
            //
            ASContext.plugin = pluginMain;
            try
            {
                context = new Contexts.Actionscript2();
                ASFileParser.Context = context;
                context.Init();
            }
            catch (Exception ex)
            {
                ErrorHandler.ShowError("Failed to initialize context.\n" + ex.Message, ex);
            }

            // documentation
            if (!MainForm.MainSettings.HasKey(SETTING_DOCUMENTATION_COMPLETION))
            {
                MainForm.MainSettings.AddValue(SETTING_DOCUMENTATION_COMPLETION, "true");
            }
            if (!MainForm.MainSettings.HasKey(SETTING_DOCUMENTATION_TAGS))
            {
                MainForm.MainSettings.AddValue(SETTING_DOCUMENTATION_TAGS, ASDocumentation.DEFAULT_DOC_TAGS);
            }
            if (!MainForm.MainSettings.HasKey(SETTING_DOCUMENTATION_TIPS))
            {
                MainForm.MainSettings.AddValue(SETTING_DOCUMENTATION_TIPS, "true");
            }
            if (!MainForm.MainSettings.HasKey(SETTING_DOCUMENTATION_DESCRIPTION))
            {
                MainForm.MainSettings.AddValue(SETTING_DOCUMENTATION_DESCRIPTION, "true");
            }

            // debugging enabled?
            DebugConsole.CheckSettings();

            // status
            UnLock();
        }
Example #3
0
        public PluginUI(PluginMain plugin)
        {
            settings = plugin.PluginSettings;
            SuspendLayout();
            InitializeControls();
            InitializeTexts();
            ResumeLayout();

            highlightTimer = new Timer();
            highlightTimer.Interval = 200;
            highlightTimer.Tick += new EventHandler(highlightTimer_Tick);
        }
Example #4
0
 public PluginUIMock(ASCompletion.PluginMain plugin) : base(plugin)
 {
 }
Example #5
0
        public PluginUIMock(PluginMain plugin) : base(plugin)
        {

        }
Example #6
0
 public PluginUI(PluginMain plugin)
 {
     settings = plugin.PluginSettings;
     SuspendLayout();
     InitializeControls();
     InitializeTexts();
     ResumeLayout();
 }
Example #7
0
 public PluginUIMock(PluginMain plugin) : base(plugin)
 {
 }
Example #8
0
		/// <summary>
		/// Init completion engine context
		/// </summary>
		/// <param name="mainForm">Reference to MainForm</param>
		static public void Init(PluginMain pluginMain)
		{
			dirSeparatorChar = System.IO.Path.DirectorySeparatorChar;
			dirSeparator = dirSeparatorChar.ToString();
			dirAltSeparatorChar = System.IO.Path.AltDirectorySeparatorChar;
			dirAltSeparator = dirAltSeparatorChar.ToString();
			doPathNormalization = dirSeparator != dirAltSeparator;
			//
			ASContext.plugin = pluginMain;
			try
			{
				context = new Contexts.Actionscript2();
				ASFileParser.Context = context;
				context.Init();
			}
			catch(Exception ex)
			{
				ErrorHandler.ShowError("Failed to initialize context.\n"+ex.Message, ex);
			}
			
			// documentation
			if (!MainForm.MainSettings.HasKey(SETTING_DOCUMENTATION_COMPLETION))
				MainForm.MainSettings.AddValue(SETTING_DOCUMENTATION_COMPLETION, "true");
			if (!MainForm.MainSettings.HasKey(SETTING_DOCUMENTATION_TAGS))
				MainForm.MainSettings.AddValue(SETTING_DOCUMENTATION_TAGS, ASDocumentation.DEFAULT_DOC_TAGS);
			if (!MainForm.MainSettings.HasKey(SETTING_DOCUMENTATION_TIPS))
				MainForm.MainSettings.AddValue(SETTING_DOCUMENTATION_TIPS, "true");
			if (!MainForm.MainSettings.HasKey(SETTING_DOCUMENTATION_DESCRIPTION))
				MainForm.MainSettings.AddValue(SETTING_DOCUMENTATION_DESCRIPTION, "true");
			
			// debugging enabled?
			DebugConsole.CheckSettings();
			
			// status
			UnLock();
		}
Example #9
0
		/// <summary>
		/// Create default context
		/// </summary>
		/// <param name="mainForm">Reference to MainForm</param>
		static public void Init(PluginMain pluginMain)
		{
			ASContext.plugin = pluginMain;
			
			// default method return type
			if (!MainForm.MainSettings.HasKey(SETTING_DEFAULT_METHOD_RETURN_TYPE))
				MainForm.MainSettings.AddValue(SETTING_DEFAULT_METHOD_RETURN_TYPE, "Object");
			// helpers enabled
			if (!MainForm.MainSettings.HasKey(SETTING_ENABLE_HELPERS))
				MainForm.MainSettings.AddValue(SETTING_ENABLE_HELPERS, "true");			
			if (!MainForm.MainSettings.HasKey(SETTING_ENABLE_AUTOIMPORT))
				MainForm.MainSettings.AddValue(SETTING_ENABLE_AUTOIMPORT, "true");
			
			// mtasc
			if (!MainForm.MainSettings.HasKey(SETTING_MTASC_PATH))
				MainForm.MainSettings.AddValue(SETTING_MTASC_PATH, 
					System.IO.Path.GetDirectoryName(Application.ExecutablePath)+DEFAULT_MTASC_PATH);
			if (!MainForm.MainSettings.HasKey(SETTING_MTASC_USECLASSES))
				MainForm.MainSettings.AddValue(SETTING_MTASC_USECLASSES, "true");
			if (!MainForm.MainSettings.HasKey(SETTING_MTASC_CHECKONSAVE))
				MainForm.MainSettings.AddValue(SETTING_MTASC_CHECKONSAVE, "false");
			if (!MainForm.MainSettings.HasKey(SETTING_MTASC_RUNAFTERBUILD))
				MainForm.MainSettings.AddValue(SETTING_MTASC_RUNAFTERBUILD, "true");
			if (!MainForm.MainSettings.HasKey(SETTING_MTASC_CHECKPARAMS))
				MainForm.MainSettings.AddValue(SETTING_MTASC_CHECKPARAMS, "-mx");
			
			// completion options
			if (!MainForm.MainSettings.HasKey(SETTING_ALWAYS_SHOW_INTRINSIC_MEMBERS))
				MainForm.MainSettings.AddValue(SETTING_ALWAYS_SHOW_INTRINSIC_MEMBERS, "false");
			if (!MainForm.MainSettings.HasKey(SETTING_HIDE_INTRINSIC_MEMBERS))
				MainForm.MainSettings.AddValue(SETTING_HIDE_INTRINSIC_MEMBERS, "false");
			if (!MainForm.MainSettings.HasKey(SETTING_FLASH_VERSION))
				MainForm.MainSettings.AddValue(SETTING_FLASH_VERSION, "8");
			
			// documentation
			if (!MainForm.MainSettings.HasKey(SETTING_DOCUMENTATION_COMPLETION))
				MainForm.MainSettings.AddValue(SETTING_DOCUMENTATION_COMPLETION, "true");
			if (!MainForm.MainSettings.HasKey(SETTING_DOCUMENTATION_TAGS))
				MainForm.MainSettings.AddValue(SETTING_DOCUMENTATION_TAGS, ASDocumentation.DEFAULT_DOC_TAGS);
			if (!MainForm.MainSettings.HasKey(SETTING_DOCUMENTATION_COMMAND))
				MainForm.MainSettings.AddValue(SETTING_DOCUMENTATION_COMMAND, DEFAULT_HELP_COMMAND);
			if (!MainForm.MainSettings.HasKey(SETTING_DOCUMENTATION_TIPS))
				MainForm.MainSettings.AddValue(SETTING_DOCUMENTATION_TIPS, "true");
			if (!MainForm.MainSettings.HasKey(SETTING_DOCUMENTATION_TIPLINES))
				MainForm.MainSettings.AddValue(SETTING_DOCUMENTATION_TIPLINES, "4");
			if (!MainForm.MainSettings.HasKey(SETTING_DOCUMENTATION_DESCRIPTION))
				MainForm.MainSettings.AddValue(SETTING_DOCUMENTATION_DESCRIPTION, "true");
			
			// debugging enabled?
			DebugConsole.CheckSettings();
			
			// Macromedia classes folder lookup
			string cp = "";
			if (!MainForm.MainSettings.HasKey(SETTING_MM_CLASSES))
			{
				bool found = false;
				string deflang = System.Globalization.CultureInfo.CurrentUICulture.Name;
				deflang = deflang.Substring(0,2);
				string localAppData = "%USERPROFILE%\\Local Settings\\Application Data\\";
					//Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
				string expandAppData = Environment.ExpandEnvironmentVariables(localAppData);
				foreach(string path in MACROMEDIA_VERSIONS)
				{
					cp = expandAppData + path;
					// default language
					if (System.IO.Directory.Exists(cp+deflang+"\\Configuration\\Classes\\"))
					{
						cp += deflang+"\\Configuration\\Classes\\";
						found = true;
					}
					// look for other languages
					else if (System.IO.Directory.Exists(cp))
					{
						string[] dirs = System.IO.Directory.GetDirectories(cp);
						foreach(string dir in dirs)
						{
							if (System.IO.Directory.Exists(dir+"\\Configuration\\Classes\\"))
							{
								cp = dir+"\\Configuration\\Classes\\";
								found = true;
							}
							else if (System.IO.Directory.Exists(dir+"\\First Run\\Classes\\"))
							{
								cp = dir+"\\First Run\\Classes\\";
								found = true;
							}
						}
					}
					if (found) break;
				}
				if (!found) cp = "";
				else cp = cp.Replace(expandAppData, localAppData);
				MainForm.MainSettings.AddValue(SETTING_MM_CLASSES, cp);
			}
			if (!MainForm.MainSettings.HasKey(SETTING_MM_HOTBUILD))
				MainForm.MainSettings.AddValue(SETTING_MM_HOTBUILD, "true");
			
			// default classpath
			if (!MainForm.MainSettings.HasKey(SETTING_CLASSPATH))
			{
				// library folder
				string libraryPath = System.IO.Path.GetDirectoryName(Application.ExecutablePath)+DEFAULT_LIBRARY_PATH;
				if (System.IO.Directory.Exists(libraryPath))
				{
					if (cp.Length > 0) cp += ";";
					cp += libraryPath;
				}
				MainForm.MainSettings.AddValue(SETTING_CLASSPATH, cp);
			}
			
			// init
			ASClassParser.Context = new ASContext();
			dirSeparatorChar = System.IO.Path.DirectorySeparatorChar;
			dirSeparator = dirSeparatorChar.ToString();
			dirAltSeparatorChar = System.IO.Path.AltDirectorySeparatorChar;
			dirAltSeparator = dirAltSeparatorChar.ToString();
			doPathNormalization = dirSeparator != dirAltSeparator;
			UpdateSettings();
		}