Exemplo n.º 1
0
 internal bool IsProjectKnown(IVsProject project) {
     var pyProj = project as IPythonProjectProvider;
     if (pyProj != null) {
         return _projectInfo.ContainsKey(pyProj.Project);
     }
     return false;
 }
Exemplo n.º 2
0
        private static async Task DoWorkInWriterLock(IVsProject project, Action<MsBuildProject> action)
        {
            UnconfiguredProject unconfiguredProject = GetUnconfiguredProject(project);
            if (unconfiguredProject != null)
            {
                var service = unconfiguredProject.ProjectService.Services.ProjectLockService;
                if (service != null)
                {
                    using (ProjectWriteLockReleaser x = await service.WriteLockAsync())
                    {
                        await x.CheckoutAsync(unconfiguredProject.FullPath);
                        ConfiguredProject configuredProject = await unconfiguredProject.GetSuggestedConfiguredProjectAsync();
                        MsBuildProject buildProject = await x.GetProjectAsync(configuredProject);

                        if (buildProject != null)
                        {
                            action(buildProject);
                        }

                        await x.ReleaseAsync();
                    }

                    await unconfiguredProject.ProjectService.Services.ThreadingPolicy.SwitchToUIThread();
                }
            }
        }
 protected override IEnumerable<string> FindTestFiles(IVsProject project)
 {
     // we don't want to react to loading/unloading of projects
     // within the solution. Test discovery is only done using
     // ctest
     return new List<string>();
 }
        public override int OnAfterRenameFiles(int cProjects, int cFiles, IVsProject[] projects, int[] firstIndices, string[] oldFileNames, string[] newFileNames, VSRENAMEFILEFLAGS[] flags)
        {
            if (!_project.IsRefreshing) {
                //Get the current value of the StartupFile Property
                string currentStartupFile = _project.GetProjectProperty(CommonConstants.StartupFile, true);
                string fullPathToStartupFile = Path.Combine(_project.ProjectDir, currentStartupFile);

                //Investigate all of the oldFileNames if they are equal to the current StartupFile
                int index = 0;
                foreach (string oldfile in oldFileNames) {
                    //Compare the files and update the StartupFile Property if the currentStartupFile is an old file
                    if (NativeMethods.IsSamePath(oldfile, fullPathToStartupFile)) {
                        //Get the newfilename and update the StartupFile property
                        string newfilename = newFileNames[index];
                        CommonFileNode node = _project.FindChild(newfilename) as CommonFileNode;
                        if (node == null)
                            throw new InvalidOperationException("Could not find the CommonFileNode object");
                        //Startup file has been renamed
                        _project.SetProjectProperty(CommonConstants.StartupFile, node.Url);
                        break;
                    }
                    index++;
                }
            }
            return VSConstants.S_OK;
        }
        public override int OnAfterRemoveFiles(int cProjects, int cFiles, IVsProject[] projects, int[] firstIndices, string[] oldFileNames, VSREMOVEFILEFLAGS[] flags)
        {
            //Get the current value of the MainFile Property
            string currentMainFile = this.project.GetProjectProperty(PythonProjectFileConstants.MainFile, true);
            string fullPathToMainFile = Path.Combine(Path.GetDirectoryName(this.project.BaseURI.Uri.LocalPath), currentMainFile);

            //Investigate all of the oldFileNames if they belong to the current project and if they are equal to the current MainFile
            int index = 0;
            foreach(string oldfile in oldFileNames)
            {
                //Compare this project with the project that the old file belongs to
                IVsProject belongsToProject = projects[firstIndices[index]];
                if(Utilities.IsSameComObject(belongsToProject, this.project))
                {
                    //Compare the files and update the MainFile Property if the currentMainFile is an old file
                    if(NativeMethods.IsSamePath(oldfile, fullPathToMainFile))
                    {
                        //Get the first available py file in the project and update the MainFile property
                        List<PythonFileNode> pythonFileNodes = new List<PythonFileNode>();
                        this.project.FindNodesOfType<PythonFileNode>(pythonFileNodes);
                        string newMainFile = string.Empty;
                        if(pythonFileNodes.Count > 0)
                        {
                            newMainFile = pythonFileNodes[0].GetRelativePath();
                        }
                        this.project.SetProjectProperty(PythonProjectFileConstants.MainFile, newMainFile);
                        break;
                    }
                }

                index++;
            }

            return VSConstants.S_OK;
        }
        public override int OnAfterAddFilesEx(int cProjects, int cFiles, IVsProject[] projects, int[] firstIndices, string[] newFileNames, VSADDFILEFLAGS[] flags)
        {
            //Get the current value of the MainFile Property
            string currentMainFile = this.project.GetProjectProperty(PythonProjectFileConstants.MainFile, true);
            if(!string.IsNullOrEmpty(currentMainFile))
                //No need for further operation since MainFile is already set
                return VSConstants.S_OK;

            string fullPathToMainFile = Path.Combine(Path.GetDirectoryName(this.project.BaseURI.Uri.LocalPath), currentMainFile);

            //Investigate all of the newFileNames if they belong to the current project and set the first pythonFileNode found equal to MainFile
            int index = 0;
            foreach(string newfile in newFileNames)
            {
                //Compare this project with the project that the new file belongs to
                IVsProject belongsToProject = projects[firstIndices[index]];
                if(Utilities.IsSameComObject(belongsToProject, this.project))
                {
                    //If the newfile is a python filenode we willl map this file to the MainFile property
                    PythonFileNode filenode = project.FindChild(newfile) as PythonFileNode;
                    if(filenode != null)
                    {
                        this.project.SetProjectProperty(PythonProjectFileConstants.MainFile, filenode.GetRelativePath());
                        break;
                    }
                }

                index++;
            }

            return VSConstants.S_OK;
        }
 public void OnSolutionProjectUpdated(IVsProject project, SolutionChangedReason reason)
 {
     if (SolutionProjectChanged != null && project != null)
     {
         SolutionProjectChanged(this, new SolutionEventsListenerEventArgs(project, reason));
     }
 }
 public ProjectReferenceAdapter(IVsProject project, Func<bool> removeFromParentProject, Action<string, KeyValuePair<string, string>> addBinaryReferenceWithMetadataIfNotExists, bool conditionTrue)
 {
     _project = project;
     _removeFromParentProject = removeFromParentProject;
     _addBinaryReferenceWithMetadataIfNotExists = addBinaryReferenceWithMetadataIfNotExists;
     Condition = conditionTrue;
 }
        private int OnNotifyTestFileAddRemove(int changedProjectCount,
                                              IVsProject[] changedProjects,
                                              string[] changedProjectItems,
                                              int[] rgFirstIndices,
                                              TestFileChangedReason reason)
        {
            // The way these parameters work is:
            // rgFirstIndices contains a list of the starting index into the changeProjectItems array for each project listed in the changedProjects list
            // Example: if you get two projects, then rgFirstIndices should have two elements, the first element is probably zero since rgFirstIndices would start at zero.
            // Then item two in the rgFirstIndices array is where in the changeProjectItems list that the second project's changed items reside.
            int projItemIndex = 0;
            for (int changeProjIndex = 0; changeProjIndex < changedProjectCount; changeProjIndex++)
            {
                int endProjectIndex = ((changeProjIndex + 1) == changedProjectCount) ? changedProjectItems.Length : rgFirstIndices[changeProjIndex + 1];

                for (; projItemIndex < endProjectIndex; projItemIndex++)
                {
                    if (changedProjects[changeProjIndex] != null && TestFileChanged != null)
                    {
                        TestFileChanged(this, new TestFileChangedEventArgs(changedProjectItems[projItemIndex], reason));
                    }

                }
            }
            return VSConstants.S_OK;
        }
        //  -------------------------------------------------------------------
        /// <summary>
        /// Creates a new submittable physical item.
        /// </summary>
        /// <param name="rootPath">
        /// The root path of the solution that contains this item.
        /// </param>
        /// <param name="project">
        /// The project that contains this item.
        /// </param>
        /// <param name="hierItem">
        /// The hierarchy item that this item represents.
        /// </param>
        public SubmittablePhysicalItem(string rootPath, IVsProject project,
			HierarchyItem hierItem)
        {
            this.rootPath = rootPath;
            this.project = project;
            this.hierarchy = hierItem;
        }
Exemplo n.º 11
0
        public static string GetProjectFilePath(IVsProject project)
        {
            string path = string.Empty;
            int hr = project.GetMkDocument((uint)VSConstants.VSITEMID.Root, out path);
            Debug.Assert(hr == VSConstants.S_OK || hr == VSConstants.E_NOTIMPL, "GetMkDocument failed for project.");

            return path;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ConfigFileWrapper"/> class.
        /// </summary>
        /// <param name="ownerProject">The owner project.</param>
        /// <param name="doc">The doc.</param>
        /// <param name="fileName">Name of the file.</param>
        public XmlFileWrapper(XmlDocument doc, string fileName=null, IVsProject ownerProject=null)
        {
            Guard.ArgumentNotNull(doc, "doc");

            Document = doc;
            FileName = fileName;
            OwnerProject = ownerProject;
        }
        //~ Methods ..........................................................
        // ------------------------------------------------------
        public int OnAfterAddDirectoriesEx(int cProjects, int cDirectories,
			IVsProject[] rgpProjects, int[] rgFirstIndices,
			string[] rgpszMkDocuments, VSADDDIRECTORYFLAGS[] rgFlags)
        {
            CxxTestPackage.Instance.TryToRefreshTestSuitesWindow();

            return VSConstants.S_OK;
        }
Exemplo n.º 14
0
        public static string GetProjectFilePath(IVsProject project)
        {
            string path = string.Empty;
            int hr = project.GetMkDocument(HierarchyConstants.VSITEMID_ROOT, out path);
            System.Diagnostics.Debug.Assert(hr == VSConstants.S_OK || hr == VSConstants.E_NOTIMPL, "GetMkDocument failed for project.");

            return path;
        }
        // ------------------------------------------------------
        public int OnAfterRemoveFiles(int cProjects, int cFiles,
			IVsProject[] rgpProjects, int[] rgFirstIndices,
			string[] rgpszMkDocuments, VSREMOVEFILEFLAGS[] rgFlags)
        {
            CxxTestPackage.Instance.TryToRefreshTestSuitesWindow();

            return VSConstants.S_OK;
        }
Exemplo n.º 16
0
        public VsItem(IVsProject vsProject)
        {
            m_vsHierarchy = vsProject as IVsHierarchy;
            Debug.Assert(object.ReferenceEquals(m_vsHierarchy, null) == object.ReferenceEquals(vsProject, null));

            m_vsItemID = VSITEMID.Root;
            m_vsParent = null;
        }
 public ProjectNugetifier(IVsProject vsProject, IPackageRepository packageRepository, IFileSystem projectFileSystem, IConsole console, IHintPathGenerator hintPathGenerator)
 {
     _console = console;
     _projectFileSystem = projectFileSystem;
     _vsProject = vsProject;
     _packageRepository = packageRepository;
     _hintPathGenerator = hintPathGenerator;
 }
Exemplo n.º 18
0
 public ProjectNode(IVsSolution vsSolution, Guid projectGuid)
     : base(vsSolution, projectGuid)
 {
     this.project = this.Hierarchy as IVsProject;
     // Commented because it will show up an error dialog before getting back control to the recipe (caller)
     //Debug.Assert(project != null);  
     Debug.Assert(ItemId == VSConstants.VSITEMID_ROOT);
 }
Exemplo n.º 19
0
 public void SetUpProjectAdapterAndBinaryDependencies()
 {
     _console = new ConsoleMock();
     _solutionProjectLoader = new CachingSolutionLoader(Paths.AdapterTestsSolutionFile, new Dictionary<string, string>(), _console.Object);
     var projectAdapters = _solutionProjectLoader.GetProjects();
     _projectWithDependenciesAdapter = projectAdapters.Single(p => p.ProjectName.Equals(ProjectWithDependenciesName, StringComparison.OrdinalIgnoreCase));
     _projectBinaryReferenceAdapters = _projectWithDependenciesAdapter.GetBinaryReferences();
 }
 private static string GetSource(IVsProject project, string source)
 {
     var directory = Directory.Exists(source) ? source : Path.GetDirectoryName(source);
     var candidates = new[]{
         Path.Combine(directory, Globals.SettingsFilename)
     };
     return candidates.FirstOrDefault(f => project.HasFile(f));
 }
 int IVsTrackProjectDocumentsEvents2.OnAfterRemoveDirectories(int cProjects,
                                                              int cDirectories,
                                                              IVsProject[] rgpProjects,
                                                              int[] rgFirstIndices,
                                                              string[] rgpszMkDocuments,
                                                              VSREMOVEDIRECTORYFLAGS[] rgFlags)
 {
     return VSConstants.S_OK;
 }
 int IVsTrackProjectDocumentsEvents2.OnAfterAddFilesEx(int cProjects,
                                                       int cFiles,
                                                       IVsProject[] rgpProjects,
                                                       int[] rgFirstIndices,
                                                       string[] rgpszMkDocuments,
                                                       VSADDFILEFLAGS[] rgFlags)
 {
     return OnNotifyTestFileAddRemove(cProjects, rgpProjects, rgpszMkDocuments, rgFirstIndices, TestFileChangedReason.Added);
 }
        public int OnAfterSccStatusChanged(IVsProject pProject, int cFiles, string[] rgpszMkDocuments, uint[] rgdwSccStatus)
        {
            List<IVsTrackProjectDocumentsEvents2> sinks = _eventSinks.Values.ToList();
            foreach (var eventSink in sinks)
            {
                eventSink.OnAfterSccStatusChanged(1, 1, new[] {pProject}, null, rgpszMkDocuments, rgdwSccStatus);
            }

            return 0;
        }
 int IVsTrackProjectDocumentsEvents2.OnAfterRemoveFiles(
     int cProjects,
     int cFiles,
     IVsProject[] rgpProjects,
     int[] rgFirstIndices,
     string[] rgpszMkDocuments,
     VSREMOVEFILEFLAGS[] rgFlags)
 {
     return this.OnNotifyTestFileAddRemove(cProjects, rgpProjects, rgpszMkDocuments, rgFirstIndices, TestFileChangedReason.Removed);
 }
Exemplo n.º 25
0
        internal static string GetTypeScriptBackedJavaScriptFile(IVsProject project, string pathToFile) {

            //Need to deal with the format being relative and explicit
            IVsBuildPropertyStorage props = (IVsBuildPropertyStorage)project;
            String outDir;
            ErrorHandler.ThrowOnFailure(props.GetPropertyValue(NodeProjectProperty.TypeScriptOutDir, null, 0, out outDir));

            string projHome = GetProjectHome(project);

            return GetTypeScriptBackedJavaScriptFile(projHome, outDir, pathToFile);
        }
 int IVsTrackProjectDocumentsEvents2.OnAfterRenameFiles(
     int cProjects,
     int cFiles,
     IVsProject[] rgpProjects,
     int[] rgFirstIndices,
     string[] rgszMkOldNames,
     string[] rgszMkNewNames,
     VSRENAMEFILEFLAGS[] rgFlags)
 {
     this.OnNotifyTestFileAddRemove(cProjects, rgpProjects, rgszMkOldNames, rgFirstIndices, TestFileChangedReason.Removed);
     return this.OnNotifyTestFileAddRemove(cProjects, rgpProjects, rgszMkNewNames, rgFirstIndices, TestFileChangedReason.Added);
 }
        public int OnAfterAddDirectoriesEx(int cProjects, int cDirectories, IVsProject[] rgpProjects, int[] rgFirstIndices,
            string[] rgpszMkDocuments, VSADDDIRECTORYFLAGS[] rgFlags)
        {
            var args = new PostProjectAddDirectoriesEventArgs(this.events);

            //VSQUERYADDFILERESULTS.VSQUERYADDFILERESULTS_AddOK;
            //VSQUERYADDFILERESULTS.VSQUERYADDFILERESULTS_AddNotOK;

            this.events.TriggerPostProjectAddDirectories(args);

            return VSConstants.S_OK;
        }
        public NonMSBuildProjectConfigStore(IVsProject project, IServiceProvider serviceProvider)
        {
            _serviceProvider = serviceProvider;
            _project = project;

            ReadConfigFromProject();

            _termTableFiles.ItemAdded += new EventHandler<ItemEventArgs<string>>(_termTableFiles_ItemAdded);
            _termTableFiles.ItemsRemoved += new EventHandler(_termTableFiles_ItemsRemoved);
            _ignoreInstances.ItemAdded += new EventHandler<ItemEventArgs<BuildTask.IIgnoreInstance>>(_ignoreInstances_ItemAdded);
            _ignoreInstances.ItemsRemoved += new EventHandler(_ignoreInstances_ItemsRemoved);
        }
Exemplo n.º 29
0
        public int OnAfterAddFilesEx(int cProjects, int cFiles, IVsProject[] rgpProjects, int[] rgFirstIndices, string[] rgpszMkDocuments, VSADDFILEFLAGS[] rgFlags)
        {
            if (FileAdded != null)
            {
                var paths = ExtractPath(cProjects, cFiles, rgpProjects, rgFirstIndices, rgpszMkDocuments);
                foreach (var path in paths)
                {
                    FileAdded(this, new FileAddedEventArgs(path));
                }
            }

            return VSConstants.S_OK;
        }
        internal void ProjectLoaded(IPythonInterpreterFactoryProvider provider, IVsProject project) {
            if (provider == null) {
                return;
            }

            lock (_providers) {
                if (!_providers.ContainsKey(provider)) {
                    _providers[provider] = project;
                    provider.InterpreterFactoriesChanged += Interpreters_InterpreterFactoriesChanged;
                }
            }
            OnInterpreterFactoriesChanged();
        }
 int IVsTrackProjectDocumentsEvents2.OnQueryRemoveFiles(IVsProject pProject, int cFiles, string[] rgpszMkDocuments, VSQUERYREMOVEFILEFLAGS[] rgFlags, VSQUERYREMOVEFILERESULTS[] pSummaryResult, VSQUERYREMOVEFILERESULTS[] rgResults)
 {
     return(VSConstants.S_OK);
 }
Exemplo n.º 32
0
 public int OnAfterAddDirectoriesEx(IVsProject pProject, int cDirectories, string[] rgpszMkDocuments, VSADDDIRECTORYFLAGS[] rgFlags)
 {
     return(VSConstants.S_OK);
 }
Exemplo n.º 33
0
 public int OnAfterRemoveFiles(IVsProject pProject, int cFiles, string[] rgpszMkDocuments, VSREMOVEFILEFLAGS[] rgFlags)
 {
     return(VSConstants.S_OK);
 }
Exemplo n.º 34
0
 public int OnAfterRenameFile(IVsProject pProject, string pszMkOldName, string pszMkNewName, VSRENAMEFILEFLAGS flags)
 {
     return(VSConstants.S_OK);
 }
Exemplo n.º 35
0
 public int OnAfterSccStatusChanged(IVsProject pProject, int cFiles, string[] rgpszMkDocuments, uint[] rgdwSccStatus)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 36
0
 public int OnQueryAddFiles(IVsProject pProject, int cFiles, string[] rgpszMkDocuments,
                            VSQUERYADDFILEFLAGS[] rgFlags, VSQUERYADDFILERESULTS[] pSummaryResult,
                            VSQUERYADDFILERESULTS[] rgResults)
 {
     return(VSConstants.S_OK);
 }
 private IEnumerable <string> GetTestFiles(IVsProject project)
 {
     return(VsSolutionHelper.GetProjectItems(project).Where(
                o => IsTestFile(o)));
 }
 public int OnQueryRenameDirectories(IVsProject pProject, int cDirs, string[] rgszMkOldNames, string[] rgszMkNewNames,
                                     VSQUERYRENAMEDIRECTORYFLAGS[] rgFlags, VSQUERYRENAMEDIRECTORYRESULTS[] pSummaryResult,
                                     VSQUERYRENAMEDIRECTORYRESULTS[] rgResults)
 {
     return(VSConstants.E_NOTIMPL);
 }
 public int OnQueryRemoveFiles(IVsProject pProject, int cFiles, string[] rgpszMkDocuments, VSQUERYREMOVEFILEFLAGS[] rgFlags,
                               VSQUERYREMOVEFILERESULTS[] pSummaryResult, VSQUERYREMOVEFILERESULTS[] rgResults)
 {
     return(VSConstants.E_NOTIMPL);
 }
 public int OnQueryRemoveDirectories(IVsProject pProject, int cDirectories, string[] rgpszMkDocuments,
                                     VSQUERYREMOVEDIRECTORYFLAGS[] rgFlags, VSQUERYREMOVEDIRECTORYRESULTS[] pSummaryResult,
                                     VSQUERYREMOVEDIRECTORYRESULTS[] rgResults)
 {
     return(VSConstants.E_NOTIMPL);
 }
Exemplo n.º 41
0
        /// <summary>
        /// Retrieves the FSharp project node from the IVsProject interface
        /// </summary>
        /// <param name="root"></param>
        /// <returns></returns>
        public static Microsoft.VisualStudio.FSharp.ProjectSystem.ProjectNode getFSharpProjectNode(IVsProject root)
        {
            IOLEServiceProvider sp;

            ErrorHandler.ThrowOnFailure(root.GetItemContext(VSConstants.VSITEMID_ROOT, out sp));

            IntPtr objPtr = IntPtr.Zero;

            try
            {
                Guid hierGuid = typeof(VSLangProj.VSProject).GUID;
                Guid UNKguid  = NativeMethods.IID_IUnknown;
                ErrorHandler.ThrowOnFailure(sp.QueryService(ref hierGuid, ref UNKguid, out objPtr));

                var OAVSProject = (VSLangProj.VSProject)Marshal.GetObjectForIUnknown(objPtr);
                var OAProject   = (Microsoft.VisualStudio.FSharp.ProjectSystem.Automation.OAProject)OAVSProject.Project;
                return(OAProject.Project);
            }
            finally
            {
                if (objPtr != IntPtr.Zero)
                {
                    Marshal.Release(objPtr);
                }
            }
        }
Exemplo n.º 42
0
        public static bool TryGetProjectPath(this IVsProject project, out string path)
        {
            ValidateArg.NotNull(project, "project");

            return(ErrorHandler.Succeeded(project.GetMkDocument(VSConstants.VSITEMID_ROOT, out path)) && !string.IsNullOrEmpty(path));
        }
Exemplo n.º 43
0
 void IVsTrackProjectDocumentsEvents4.OnQueryRemoveFilesEx(IVsProject pProject, int cFiles, string[] rgpszMkDocuments, uint[] rgFlags, VSQUERYREMOVEFILERESULTS[] pSummaryResult, VSQUERYREMOVEFILERESULTS[] rgResults)
 {
 }
 public int OnQueryRenameFiles(IVsProject pProject, int cFiles, string[] rgszMkOldNames, string[] rgszMkNewNames,
                               VSQUERYRENAMEFILEFLAGS[] rgFlags, VSQUERYRENAMEFILERESULTS[] pSummaryResult, VSQUERYRENAMEFILERESULTS[] rgResults)
 {
     return(VSConstants.E_NOTIMPL);
 }
Exemplo n.º 45
0
 int IVsTrackProjectDocumentsEvents3.OnQueryAddFilesEx(IVsProject pProject, int cFiles, string[] rgpszNewMkDocuments, string[] rgpszSrcMkDocuments, VSQUERYADDFILEFLAGS[] rgFlags, VSQUERYADDFILERESULTS[] pSummaryResult, VSQUERYADDFILERESULTS[] rgResults)
 {
     return(VSConstants.S_OK);
 }
Exemplo n.º 46
0
        //[CLSCompliant(false)]
        public static bool GetSccFiles(IVsHierarchy hierarchy, IVsSccProject2 sccProject, uint id, out string[] files, out int[] flags, bool includeNoScc, IDictionary <string, uint> map)
        {
            if (hierarchy == null)
            {
                throw new ArgumentNullException("hierarchy");
            }

            int  hr;
            bool ok = false;

            files = null;
            flags = null;

            try
            {
                if (sccProject != null)
                {
                    CALPOLESTR[] str = new CALPOLESTR[1];
                    CADWORD[]    dw  = new CADWORD[1];

                    if (VSErr.Succeeded(hr = sccProject.GetSccFiles(id, str, dw)))
                    {
                        files = GetFileNamesFromOleBuffer(str, true);
                        flags = GetFlagsFromOleBuffer(dw, true);

                        if (!includeNoScc || files.Length > 0)
                        {
                            return(ok = true); // We have a result
                        }
                        else
                        {
                            ok = true; // Try the GetMkDocument route to find an alternative
                        }
                    }
                    else if (hr != VSErr.E_NOTIMPL)
                    {
                        return(false); //
                    }
                }

                // If sccProject2.GetSccFiles() returns E_NOTIMPL we must try GetMkDocument
                // We also try this if the item does not implement IVsSccProject2

                IVsProject project = hierarchy as IVsProject;
                if (project != null)
                {
                    string mkDocument;

                    try
                    {
                        if (VSErr.Succeeded(project.GetMkDocument(id, out mkDocument)))
                        {
                            if (!IsValidPath(mkDocument, true))
                            {
                                files = new string[0];
                            }
                            else
                            {
                                files = new string[] { mkDocument }
                            };

                            return(true);
                        }
                    }
                    catch
                    { }

                    return(ok); // No need to check our interface for projects
                }

                if (hierarchy is IVsSolution)
                {
                    return(ok); // Will fail in GetCanonicalName in VS2008 SP1 Beta 1
                }

                string name;
                try
                {
                    if (VSErr.Succeeded(hierarchy.GetCanonicalName(id, out name)))
                    {
                        if (IsValidPath(name, true))
                        {
                            files = new string[] { name };
                            return(true);
                        }
                    }
                }
                catch { } // Ok, this seems to error in some managed tree implementations like TFS :(

                return(ok);
            }
            finally
            {
                if (ok && map != null && files != null)
                {
                    foreach (string file in files)
                    {
                        map[file] = id;
                    }
                }
            }
        }
Exemplo n.º 47
0
 public int OnQueryAddDirectories(IVsProject pProject, int cDirectories,
                                  string[] rgpszMkDocuments, VSQUERYADDDIRECTORYFLAGS[] rgFlags,
                                  VSQUERYADDDIRECTORYRESULTS[] pSummaryResult, VSQUERYADDDIRECTORYRESULTS[] rgResults)
 {
     return(VSConstants.S_OK);
 }
 int IVsTrackProjectDocumentsEvents2.OnQueryRenameDirectories(IVsProject pProject, int cDirs, string[] rgszMkOldNames, string[] rgszMkNewNames, VSQUERYRENAMEDIRECTORYFLAGS[] rgFlags, VSQUERYRENAMEDIRECTORYRESULTS[] pSummaryResult, VSQUERYRENAMEDIRECTORYRESULTS[] rgResults)
 {
     return(VSConstants.S_OK);
 }
Exemplo n.º 49
0
 public int OnQueryAddDirectories(IVsProject pProject, int cDirectories, string[] rgpszMkDocuments, VSQUERYADDDIRECTORYFLAGS[] rgFlags, VSQUERYADDDIRECTORYRESULTS[] pSummaryResult, VSQUERYADDDIRECTORYRESULTS[] rgResults)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 50
0
 int IVsSolution.QueryRenameProject(IVsProject project, string oldName, string newName, uint reserved, out int renameCanContinue)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 51
0
 public int OnAfterRenameFiles(IVsProject pProject, int cFiles, string[] rgszMkOldNames, string[] rgszMkNewNames, VSRENAMEFILEFLAGS[] rgFlags)
 {
     return(VSConstants.S_OK);
 }
Exemplo n.º 52
0
 public int OnAfterRemoveDirectories(IVsProject pProject, int cDirectories, string[] rgpszMkDocuments, VSREMOVEDIRECTORYFLAGS[] rgFlags)
 {
     return(VSConstants.S_OK);
 }
Exemplo n.º 53
0
 public int OnAfterRenameDirectories(IVsProject pProject, int cDirs, string[] rgszMkOldNames, string[] rgszMkNewNames, VSRENAMEDIRECTORYFLAGS[] rgFlags)
 {
     return(VSConstants.S_OK);
 }
Exemplo n.º 54
0
 public int OnAfterAddFiles(IVsProject pProject, int cFiles, string[] rgpszMkDocuments)
 {
     return(VSConstants.S_OK);
 }
Exemplo n.º 55
0
 int IVsSolution.OnAfterRenameProject(IVsProject project, string oldName, string newName, uint reserved)
 {
     throw new NotImplementedException();
 }
 int IVsTrackProjectDocumentsEvents2.OnQueryRenameFiles(IVsProject pProject, int cFiles, string[] rgszMkOldNames, string[] rgszMkNewNames, VSQUERYRENAMEFILEFLAGS[] rgFlags, VSQUERYRENAMEFILERESULTS[] pSummaryResult, VSQUERYRENAMEFILERESULTS[] rgResults)
 {
     return(VSConstants.S_OK);
 }
Exemplo n.º 57
0
 public int OnAfterAddFilesEx(IVsProject pProject, int cFiles, string[] rgpszMkDocuments, VSADDFILEFLAGS[] rgFlags)
 {
     return(VSConstants.S_OK);
 }
Exemplo n.º 58
0
 void IVsTrackProjectDocumentsEvents4.OnQueryRemoveDirectoriesEx(IVsProject pProject, int cDirectories, string[] rgpszMkDocuments, uint[] rgFlags, VSQUERYREMOVEDIRECTORYRESULTS[] pSummaryResult, VSQUERYREMOVEDIRECTORYRESULTS[] rgResults)
 {
 }
Exemplo n.º 59
0
 public int OnQueryRenameFiles(IVsProject pProject, int cFiles, string[] rgszMkOldNames, string[] rgszMkNewNames, VSQUERYRENAMEFILEFLAGS[] rgFlags, VSQUERYRENAMEFILERESULTS[] pSummaryResult, VSQUERYRENAMEFILERESULTS[] rgResults)
 {
     throw new NotImplementedException();
 }
 int IVsTrackProjectDocumentsEvents2.OnQueryRemoveDirectories(IVsProject pProject, int cDirectories, string[] rgpszMkDocuments, VSQUERYREMOVEDIRECTORYFLAGS[] rgFlags, VSQUERYREMOVEDIRECTORYRESULTS[] pSummaryResult, VSQUERYREMOVEDIRECTORYRESULTS[] rgResults)
 {
     return(VSConstants.S_OK);
 }