예제 #1
0
        /// <summary>
        /// Fires the <see cref="ProjectChanged" /> event. This occurs <b>after</b> the events <see cref="ProjectOpened" />,
        /// <see cref="ProjectClosed" />, <see cref="ProjectRenamed" />, and <see cref="ProjectDirtyChanged" /> event. Usefull if
        /// you not want to subscribe to the above mentioned single events.
        /// </summary>
        protected virtual void OnProjectChanged(ProjectEventArgs e)
        {
            switch (e.ProjectEventKind)
            {
            case ProjectEventKind.ProjectOpening:
                break;

            case ProjectEventKind.ProjectOpened:
                ProjectOpened?.Invoke(this, e);
                break;

            case ProjectEventKind.ProjectClosing:
                break;

            case ProjectEventKind.ProjectClosed:
                ProjectClosed?.Invoke(this, e);
                break;

            case ProjectEventKind.ProjectRenamed:
                ProjectRenamed?.Invoke(this, (ProjectRenamedEventArgs)e);
                break;

            case ProjectEventKind.ProjectDirtyChanged:
                ProjectDirtyChanged?.Invoke(this, e);
                break;

            default:
                break;
            }

            ProjectChanged?.Invoke(this, e);
        }
 private void SolutionEvents_ProjectRenamed(Project project, string oldName)
 {
     if (ProjectArguments.IsSupportedProject(project))
     {
         ProjectRenamed?.Invoke(this, new ProjectRenamedEventArgs {
             project = project, oldName = oldName
         });
     }
 }
        // fired when various properties are changed on items, like the caption,
        // but also expanded state, etc.
        //
        public override int OnPropertyChanged(uint item, int prop, uint flags)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            if (prop != (int)__VSHPROPID.VSHPROPID_Caption)
            {
                // ignore everything except renaming
                return(VSConstants.S_OK);
            }

            Trace(
                "OnPropertyChanged caption: item={0} prop={1} flags={2}",
                item, prop, flags);

            // this is fired when renaming:
            //
            // 1) projects
            // this is handled here for all projects and ignored in
            // DocumentEvents.OnAfterAttributeChangeEx
            //
            // 2) C++ folders
            // this is handled here
            //
            // 3) C++ files
            // this is ignored because DocumentEvents.OnAfterAttributeChangeEx
            // is also fired; for whatever reason, OnPropertyChanged is fired
            // *3*  times with the exact same arguments, and so cannot be
            // differentiated, which would force an update three times every
            // time a file is renamed

            if (item == (uint)VSConstants.VSITEMID.Root)
            {
                // itemid of root means this is a project
                ProjectRenamed?.Invoke(new VSTreeItem(Hierarchy, item));
            }
            else if (VSTreeItem.GetIsFolder(Hierarchy, item))
            {
                // this is a C++ folder
                FolderRenamed?.Invoke(new VSTreeItem(Hierarchy, item));
            }

            return(VSConstants.S_OK);
        }
 private void OnProjectRenamed(object sender, IProjectContextInfo e)
 {
     ProjectRenamed?.Invoke(this, e);
 }
예제 #5
0
 private void ProjectRenamedHandler(object sender, ProjectRenamedEventArgs e)
 {
     ProjectRenamed?.Invoke(sender, e);
 }
 internal void RaiseProjectRenamed(IProjectContextInfo project)
 {
     ProjectRenamed?.Invoke(this, project);
 }
예제 #7
0
 public int OnAfterRenameProject(IVsHierarchy hierarchy)
 {
     ProjectRenamed?.Invoke(this, new HierarchyEventArgs(hierarchy));
     return(0);
 }