public void Init(DalConfig config, string fileName, SimpleDataAccessLayerConfigFileEditorPackage package)
        {
            connectionStrings = InitializeConectionStringsCollection(package, fileName);
            this.package = package;
            this.config = config;
            this.fileName = fileName;

            if (config == null)
            {
                HandleInvalidFileFormat();
            }
            else
            {
                InitControls();
            }
        }
        public EditorFactory(SimpleDataAccessLayerConfigFileEditorPackage package)
        {
            Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering {0} constructor", this.ToString()));

            this.editorPackage = package;
        }
		/// <summary>
		/// Initialization routine for the Editor. Loads the list of properties for the dal document 
		/// which will show up in the properties window 
		/// </summary>
		/// <param name="package"></param>
		private void PrivateInit(SimpleDataAccessLayerConfigFileEditorPackage package)
		{
			myPackage = package;
			loading = false;
			gettingCheckoutStatus = false;
			trackSel = null;

			Control.CheckForIllegalCrossThreadCalls = false;
			// Create an ArrayList to store the objects that can be selected
			ArrayList listObjects = new ArrayList();

			// Create the object that will show the document's properties
			// on the properties window.
			EditorProperties prop = new EditorProperties(this);
			listObjects.Add(prop);

			// Create the SelectionContainer object.
			selContainer = new Microsoft.VisualStudio.Shell.SelectionContainer(true, false);
			selContainer.SelectableObjects = listObjects;
			selContainer.SelectedObjects = listObjects;

			// Create and initialize the editor

			System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditorPane));
			this.editorControl = new MyEditor();

			resources.ApplyResources(this.editorControl, "editorControl", CultureInfo.CurrentUICulture);
			
			// Handle Focus event
			// I should override this one
			//this.editorControl.RichTextBoxControl.GotFocus += new EventHandler(this.OnGotFocus);

			// Call the helper function that will do all of the command setup work
			// -- no commands here // setupCommands();
		}
        private Dictionary<string, string> InitializeConectionStringsCollection(SimpleDataAccessLayerConfigFileEditorPackage package, string fileName)
        {
            EnvDTE.Project _project = package.GetEnvDTE().Solution.FindProjectItem(fileName).ContainingProject;

            string _configurationFilename = null;
            System.Configuration.Configuration _configuration = null;
            // examine each project item's filename looking for app.config or web.config
            foreach (EnvDTE.ProjectItem item in _project.ProjectItems)
            {
                if (Regex.IsMatch(item.Name, "(app|web).config", RegexOptions.IgnoreCase))
                {
                    // TODO: try this with linked files. is the filename pointing to the source?
                    _configurationFilename = item.get_FileNames(0);
                    break;
                }
            }

            Dictionary<string, string> _returnValue = new Dictionary<string, string>();

            if (!string.IsNullOrEmpty(_configurationFilename))
            {
                // found it, map it and expose salient members as properties
                ExeConfigurationFileMap _configFile = null;
                _configFile = new ExeConfigurationFileMap();
                _configFile.ExeConfigFilename = _configurationFilename;
                _configuration = System.Configuration.ConfigurationManager.OpenMappedExeConfiguration(_configFile, ConfigurationUserLevel.None);

                foreach (ConnectionStringSettings _connStringSettings in _configuration.ConnectionStrings.ConnectionStrings)
                {
                    _returnValue.Add(_connStringSettings.Name, _connStringSettings.ConnectionString);
                }
            }

            return _returnValue;
        }
		/// <summary>
		/// Constructor that calls the Microsoft.VisualStudio.Shell.WindowPane constructor then
		/// our initialization functions.
		/// </summary>
		/// <param name="package">Our Package instance.</param>
		public EditorPane(SimpleDataAccessLayerConfigFileEditorPackage package)
			: base(null)
		{
			PrivateInit(package);
		}