private void InitImageHandler()
        {
            Debug.Assert(this.nestedHierarchy != null, "The nested hierarchy object must be created before calling this method");

            if (null == imageHandler)
            {
                imageHandler = new ImageHandler();
            }
            object imageListAsPointer = null;
            this.nestedHierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_IconImgList, out imageListAsPointer);
            if (imageListAsPointer != null)
            {
                this.imageHandler.ImageList = Utilities.GetImageList(imageListAsPointer);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Disposes the project node object.
        /// </summary>
        /// <param name="disposing">Flag determining ehether it was deterministic or non deterministic clean up.</param>
        protected override void Dispose(bool disposing)
        {
            if (this.isDisposed)
            {
                return;
            }

            try
            {
                try
                {
                    this.UnRegisterProject();
                }
                finally
                {
                    try
                    {
                        this.RegisterClipboardNotifications(false);
                    }
                    finally
                    {
                        try
                        {
                            if (this.globalPropertyHandler != null)
                            {
                                this.globalPropertyHandler.ActiveConfigurationChanged -= new EventHandler<ActiveConfigurationChangedEventArgs>(this.OnHandleConfigurationRelatedGlobalProperties);

                                this.globalPropertyHandler.Dispose();
                            }

                            if (this.projectEventsProvider != null)
                            {
                                this.projectEventsProvider.AfterProjectFileOpened -= this.OnAfterProjectOpen;
                            }
                            if (this.taskProvider != null)
                            {
                                taskProvider.Tasks.Clear();
                                this.taskProvider.Dispose();
                                this.taskProvider = null;
                            }
                            if (buildLogger != null)
                            {
                                buildLogger = null;
                            }
                            this.site = null;
                        }
                        finally
                        {
                            if (this.buildEngine != null)
                            {
                                this.buildEngine.UnregisterAllLoggers();
                                this.buildEngine = null;
                            }
                        }
                    }
                }

                if (this.buildProject != null)
                {
                    this.buildProject.ParentEngine.UnloadProject(this.buildProject);
                    this.buildProject = null;
                }

                if (null != imageHandler)
                {
                    imageHandler.Close();
                    imageHandler = null;
                }
            }
            finally
            {
                base.Dispose(disposing);
                this.isDisposed = true;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Disposes the project node object.
        /// </summary>
        /// <param name="disposing">Flag determining ehether it was deterministic or non deterministic clean up.</param>
        protected override void Dispose(bool disposing)
        {
            if (this.isDisposed)
            {
                return;
            }

            try
            {
                try
                {
                    this.UnRegisterProject();
                }
                finally
                {
                    try
                    {
                        this.RegisterClipboardNotifications(false);
                    }
                    finally
                    {
                        try
                        {

                            if (this.projectEventsProvider != null)
                            {
                                this.projectEventsProvider.AfterProjectFileOpened -= this.OnAfterProjectOpen;
                            }
                            if (this.taskProvider != null)
                            {
                                this.taskProvider.Tasks.Clear();
                                this.taskProvider.Refresh();
                                this.taskProvider.Dispose();
                                this.taskProvider = null;
                            }
                            if (buildLogger != null)
                            {
                                buildLogger = null;
                            }
                            this.site = null;
                        }
                        finally
                        {
                            if (this.buildEngine != null)
                            {
                                this.buildEngine.UnregisterAllLoggers();
                                this.buildEngine = null;
                            }
                        }
                    }
                }

                if (this.buildProject != null)
                {
                    //this.projectInstance = null;
                    MSBuildProject.FullyUnloadProject(this.buildProject.ProjectCollection, this.buildProject);
                    SetBuildProject(null);
                }

                if (null != imageHandler)
                {
                    imageHandler.Close();
                    imageHandler = null;
                }
            }
            finally
            {
                base.Dispose(disposing);
                this.isDisposed = true;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Closes the project node.
        /// </summary>
        /// <returns>A success or failure value.</returns>
        public override int Close()
        {
            int hr = VSConstants.S_OK;

            try
            {
                this.UnRegisterProject();
            }
            catch (COMException e)
            {
                Trace.WriteLine(e);
                hr = e.ErrorCode;
            }
            finally
            {
                try
                {
                    this.RegisterClipboardNotifications(false);
                    hr = ErrorHandler.ThrowOnFailure(base.Close());
                }
                catch (COMException e)
                {
                    Trace.WriteLine(e);
                    hr = e.ErrorCode;
                }
                finally
                {
                    try
                    {
                        if (this.projectEventsProvider != null)
                        {
                            this.projectEventsProvider.AfterProjectFileOpened -= this.OnAfterProjectOpen;
                        }
                        if (this.taskProvider != null)
                        {
                            taskProvider.Tasks.Clear();
                            this.taskProvider.Dispose();
                            this.taskProvider = null;
                        }
                        if (buildLogger != null)
                        {
                            buildLogger = null;
                        }
                        this.site = null;
                        this.isClosed = true;
                    }
                    finally
                    {
                        if (this.buildEngine != null)
                        {
                            this.buildEngine.UnregisterAllLoggers();
                            this.buildEngine = null;
                        }
                    }
                }
            }
            try
            {
                if (this.buildProject != null)
                {
                    this.buildProject.ParentEngine.UnloadProject(this.buildProject);
                    this.buildProject = null;
                }
                if (null != imageHandler)
                {
                    imageHandler.Close();
                    imageHandler = null;
                }
            }
            catch (Exception e)
            {
                Trace.WriteLine(e.Message);
                Debug.Fail(e.Message);
            }
            return hr;
        }