public int OnItemAdded(uint itemidParent, uint itemidSiblingPrev, uint itemidAdded) { // Check if the item is a nemerle file. // string itemName; string parentName; string siblingName; _hierarchy.GetCanonicalName(itemidAdded, out itemName); _hierarchy.GetCanonicalName(itemidParent, out parentName); _hierarchy.GetCanonicalName(itemidSiblingPrev, out siblingName); Debug.WriteLine(string.Format("\tOnItemsAdded {0} to {1} next to {2} \n", Path.GetFileName(itemName), Path.GetFileName(parentName), Path.GetFileName(siblingName))); string name; if (!IsNemerleFile(itemidAdded, out name)) { return(VSConstants.S_OK); } // This item is a nemerle file, so we can notify that it is added to the hierarchy. // if (ItemAdded != null) { HierarchyEventArgs args = new HierarchyEventArgs(itemidAdded, name); ItemAdded(_hierarchy, args); } return(VSConstants.S_OK); }
public int OnItemAdded(uint itemidParent, uint itemidSiblingPrev, uint itemidAdded) { ThreadHelper.ThrowIfNotOnUIThread(); //Logger.Log("Item Added"); //Logger.Log($"Project {Project?.Name}"); vsHierarchy.GetCanonicalName(itemidAdded, out var fullName); //Logger.Log($"Item Canonical Name : {fullName}"); vsHierarchy.GetProperty(itemidAdded, (int)__VSHPROPID.VSHPROPID_FirstChild, out object item); var itemName = item as string; //Logger.Log($"Get Property : {itemName}"); vsHierarchy.GetCanonicalName(itemidParent, out var pName); //Logger.Log($"Parent Canonical Name : {pName}"); //// Logger.Log($"itemidParent : {itemidParent}"); //// Logger.Log($"itemidSiblingPrev : {itemidSiblingPrev}"); //Logger.Log($"item id: {itemidAdded}"); //Logger.Log("-------------------"); //Logger.Log(""); ViewModelLocator.Instance.Scanner.ScanFile(fullName, Project); return(VSConstants.S_OK); }
public static IEnumerable <string> GetProjectItems(this IVsHierarchy project, uint itemID) { object item; // Get first item project.GetProperty(itemID, (int)__VSHPROPID.VSHPROPID_FirstVisibleChild, out item); while (item != null) { string canonicalName; project.GetCanonicalName((uint)(int)item, out canonicalName); if (!string.IsNullOrWhiteSpace(canonicalName)) { yield return(canonicalName); } // Call recursively for children foreach (var child in project.GetProjectItems((uint)(int)item)) { yield return(child); } // Get next sibling project.GetProperty((uint)(int)item, (int)__VSHPROPID.VSHPROPID_NextVisibleSibling, out item); } }
/// <summary> /// Obtains the <see cref="UnconfiguredProject"/> for <paramref name="vsHierarchy"/>, /// optionally testing whether it has a capability match to <paramref name="appliesToExpression"/>. /// </summary> /// <param name="projectService">The project service to invoke this method on.</param> /// <param name="vsHierarchy">The VS hierarchy object, which must represent a CPS project.</param> /// <param name="appliesToExpression">An optional project capability match expression to filter out non-matching projects.</param> /// <returns> /// The CPS <see cref="UnconfiguredProject"/> for the given hierarchy node, matching any (optional) /// capability expression, or <see langword="null"/> if no suitable project exists. /// </returns> public static UnconfiguredProject?GetUnconfiguredProject(this IProjectService projectService, IVsHierarchy vsHierarchy, string?appliesToExpression = null) { // We need IProjectService2.GetLoadedProject. if (projectService is IProjectService2 projectService2) { vsHierarchy.GetCanonicalName((uint)VSITEMID.Root, out string?projectFilePath); // Ensure we have a path. if (!Strings.IsNullOrEmpty(projectFilePath)) { UnconfiguredProject?unconfiguredProject = projectService2.GetLoadedProject(projectFilePath); // Ensure CPS knows a project having that path. if (unconfiguredProject is not null) { // If capabilites were requested, match them. if (appliesToExpression is null || unconfiguredProject.Capabilities.AppliesTo(appliesToExpression)) { // Found a matching project. return(unconfiguredProject); } } } } return(null); }
private void MenuItemCallback(object sender, EventArgs e) { IntPtr hierarchyPtr, selectionContainerPtr; uint projectItemId; IVsMultiItemSelect mis; IVsMonitorSelection monitorSelection = (IVsMonitorSelection)Package.GetGlobalService(typeof(SVsShellMonitorSelection)); monitorSelection.GetCurrentSelection(out hierarchyPtr, out projectItemId, out mis, out selectionContainerPtr); IVsHierarchy hierarchy = Marshal.GetTypedObjectForIUnknown(hierarchyPtr, typeof(IVsHierarchy)) as IVsHierarchy; if (hierarchy != null) { object value; hierarchy.GetProperty(projectItemId, (int)__VSHPROPID.VSHPROPID_ExtSelectedItem, out value); string path; hierarchy.GetCanonicalName(projectItemId, out path); string codePath = this.GetCodePath(path); if (File.Exists(codePath)) { this.dte.OpenFileInPreviewTab(codePath); } else { string fileName = Path.GetFileName(codePath); this.dte.StatusBar.Text = $"Cannot find file '{fileName}'"; } } }
/// <summary> /// Show the Topic Previewer tool window /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void TopicPreviewerWindowExecuteHandler(object sender, EventArgs e) { IntPtr ppHier = IntPtr.Zero, ppSC = IntPtr.Zero; uint pitemid; IVsMultiItemSelect ppMIS; string filename = null; var window = this.FindToolWindow(typeof(ToolWindows.TopicPreviewerToolWindow), 0, true); if (window == null || window.Frame == null) { throw new NotSupportedException("Unable to create Topic Previewer tool window"); } var windowFrame = (IVsWindowFrame)window.Frame; Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show()); TopicPreviewerToolWindow previewer = window as TopicPreviewerToolWindow; if (previewer != null) { var ms = Utility.GetServiceFromPackage <IVsMonitorSelection, SVsShellMonitorSelection>(true); if (ms != null) { try { // Get the current filename and, if it's a MAML topic, show it by default ms.GetCurrentSelection(out ppHier, out pitemid, out ppMIS, out ppSC); if (pitemid != VSConstants.VSITEMID_NIL && ppHier != IntPtr.Zero) { IVsHierarchy hierarchy = Marshal.GetObjectForIUnknown(ppHier) as IVsHierarchy; hierarchy.GetCanonicalName(pitemid, out filename); if (filename != null && !filename.EndsWith(".aml", StringComparison.OrdinalIgnoreCase)) { filename = null; } } } finally { if (ppHier != IntPtr.Zero) { Marshal.Release(ppHier); } if (ppSC != IntPtr.Zero) { Marshal.Release(ppSC); } } } previewer.PreviewTopic(CurrentSandcastleProject, filename); } }
public LibraryNode(string name, LibraryNodeType type, LibraryNodeCapabilities capabilities, CommandID contextMenuID, ModuleId moduleId) { this.capabilities = capabilities; this.contextMenuID = contextMenuID; this.name = name; this.uniquename = name; this.tooltip = name; this.type = type; parent = null; children = new List <LibraryNode>(); clipboardFormats = new List <VSOBJCLIPFORMAT>(); filteredView = new Dictionary <LibraryNodeType, LibraryNode>(); if (moduleId != null) { this.ownerHierarchy = moduleId.Hierarchy; this.fileId = moduleId.ItemID; ownerHierarchy.GetCanonicalName(fileId, out this.path); } sourceSpan = new TextSpan(); if (type == LibraryNodeType.Package) { this.CanGoToSource = false; } else { this.CanGoToSource = true; } if (type == LibraryNodeType.Members) { displayData.Image = (ushort)OMGlyphType.Members; displayData.SelectedImage = displayData.Image; } }
public static string GetCanonicalName(uint itemId, IVsHierarchy hierarchy) { string strRet = string.Empty; int hr = hierarchy.GetCanonicalName(itemId, out strRet); if (hr == VSConstants.E_NOTIMPL) { // Special case E_NOTIMLP to avoid perf hit to throw an exception. return(string.Empty); } else { try { ErrorHandler.ThrowOnFailure(hr); } catch (System.Runtime.InteropServices.COMException) { strRet = string.Empty; } // This could be in the case of S_OK, S_FALSE, etc. return(strRet); } }
private string GetFilePath(IVsHierarchy hierarchy, uint itemId) { ThreadHelper.ThrowIfNotOnUIThread(); // GetMkDocument and GetCanonicalName don't work on the solution/root node. if (hierarchy == null || HierarchyUtilities.IsSolutionNode(hierarchy, itemId)) { return(RetrieveCurrentSolutionPath()); } int hr; string?file; // We prefer IVsProject, but it's not available in all projects. if (hierarchy is IVsProject project) { hr = project.GetMkDocument(itemId, out file); } else { hr = hierarchy.GetCanonicalName(itemId, out file); } if (ErrorHandler.Failed(hr) || file == null) { file = string.Empty; } return(file); }
public static string GetCanonicalName(uint itemId, IVsHierarchy hierarchy) { string strRet = string.Empty; int hr = hierarchy.GetCanonicalName(itemId, out strRet); if (hr == VSConstants.E_NOTIMPL) { // Special case E_NOTIMLP to avoid perf hit to throw an exception. return string.Empty; } else { try { ErrorHandler.ThrowOnFailure(hr); } catch (System.Runtime.InteropServices.COMException) { strRet = string.Empty; } // This could be in the case of S_OK, S_FALSE, etc. return strRet; } }
private static ProjectReferenceNode GetProjectReferenceOnNodeForHierarchy(IList <ReferenceNode> references, IVsHierarchy inputHierarchy) { if (references == null) { return(null); } Guid projectGuid; ErrorHandler.ThrowOnFailure(inputHierarchy.GetGuidProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ProjectIDGuid, out projectGuid)); string canonicalName; ErrorHandler.ThrowOnFailure(inputHierarchy.GetCanonicalName(VSConstants.VSITEMID_ROOT, out canonicalName)); foreach (ReferenceNode refNode in references) { ProjectReferenceNode projRefNode = refNode as ProjectReferenceNode; if (projRefNode != null) { if (projRefNode.ReferencedProjectGuid == projectGuid) { return(projRefNode); } // Try with canonical names, if the project that is removed is an unloaded project than the above criteria will not pass. if (!String.IsNullOrEmpty(projRefNode.Url) && NativeMethods.IsSamePath(projRefNode.Url, canonicalName)) { return(projRefNode); } } } return(null); }
private string GetSelectedFileFullPath(uint itemid, IVsHierarchy hierarchy) { string filePath; hierarchy.GetCanonicalName(itemid, out filePath); return(filePath); }
private async Task <string> GetFileName(IVsHierarchy hierHierarchy, uint itemidNode) { if (itemidNode == VSConstants.VSITEMID_ROOT) { if (hierHierarchy == null) { return(await GetSolutionFileName()); } else { return(await GetProjectFileName(hierHierarchy)); } } else { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); string fileName = null; if (hierHierarchy.GetCanonicalName(itemidNode, out fileName) != VSConstants.S_OK) { return(null); } return(GetCaseSensitiveFileName(fileName)); } }
private void RemoveProjectHierarchy(IVsHierarchy h) { ThreadHelper.ThrowIfNotOnUIThread(); // the canonical name of a project hierarchy object is unique, so // it is used as a key in the dictionary var e = h.GetCanonicalName( (uint)VSConstants.VSITEMID.Root, out var cn); if (e != VSConstants.S_OK) { ErrorCode(e, "RemoveProjectHierarchy: GetCanonicalName failed"); return; } Log("RemoveProjectHierarchy: removing {0} from list", cn); hierarchyHandlers.TryGetValue(cn, out var hh); if (hh == null) { Error("RemoveProjectHierarchy: {0} not in list", cn); return; } // unregistering from events hh.Unregister(); hierarchyHandlers.Remove(cn); }
private bool IsFoxProFile(uint itemId, out string canonicalName) { // Find out if this item is a physical file. Guid typeGuid = Guid.Empty; canonicalName = null; int hr = VSConstants.S_OK; try { hr = hierarchy.GetGuidProperty(itemId, (int)__VSHPROPID.VSHPROPID_TypeGuid, out typeGuid); } catch (System.Runtime.InteropServices.COMException) { //For WPF Projects, they will throw an exception when trying to access this property if the //guid is empty. These are caught and ignored here. } if (Microsoft.VisualStudio.ErrorHandler.Failed(hr) || VSConstants.GUID_ItemType_PhysicalFile != typeGuid) { // It is not a file, we can exit now. return(false); } // This item is a file; find if it is a pyhon file. hr = hierarchy.GetCanonicalName(itemId, out canonicalName); if (Microsoft.VisualStudio.ErrorHandler.Failed(hr)) { return(false); } string extension = System.IO.Path.GetExtension(canonicalName); return(0 == string.Compare(extension, FoxProConstants.FoxProFileExtension, StringComparison.OrdinalIgnoreCase)); }
public static string GetRootCanonicalName(this IVsHierarchy heirarchy) { string path; ErrorHandler.ThrowOnFailure(heirarchy.GetCanonicalName(VSConstants.VSITEMID_ROOT, out path)); return(path); }
public static string GetProjectPath(IVsHierarchy project) { ThreadHelper.ThrowIfNotOnUIThread(); project.GetCanonicalName(VSConstants.VSITEMID_ROOT, out string projectPath); return(projectPath); }
public void RemoveErrors(IVsHierarchy aHierarchy) { UIUpdater.InvokeAsync(() => { SuspendRefresh(); for (int i = Tasks.Count - 1; i >= 0; --i) { var errorTask = Tasks[i] as ErrorTask; aHierarchy.GetCanonicalName(Microsoft.VisualStudio.VSConstants.VSITEMID_ROOT, out string nameInHierarchy); if (null == errorTask.HierarchyItem) { return; } errorTask.HierarchyItem.GetCanonicalName(Microsoft.VisualStudio.VSConstants.VSITEMID_ROOT, out string nameErrorTaskHierarchy); if (nameInHierarchy == nameErrorTaskHierarchy) { errorTask.Navigate -= ErrorTaskNavigate; Tasks.Remove(errorTask); } } ResumeRefresh(); }).SafeFireAndForget(); }
// called once per project, registers for project hierarchy events and // adds the handler to the list // private void AddProjectHierarchy(IVsHierarchy h) { ThreadHelper.ThrowIfNotOnUIThread(); // the canonical name of a project hierarchy object is unique, so // it is used as a key in the dictionary var e = h.GetCanonicalName( (uint)VSConstants.VSITEMID.Root, out var cn); if (e != VSConstants.S_OK) { ErrorCode(e, "AddProjectHierarchy: GetCanonicalName failed"); return; } Log("AddProjectHierarchy: adding {0} to list", cn); if (hierarchyHandlers.ContainsKey(cn)) { Error("AddProjectHierarchy: list already contains {0}", cn); return; } var hh = new HierarchyEventHandlers(h); // registering for hierarchy events on this project hh.Register(); // forwarding hh.ProjectRenamed += ProjectRenamed; hh.FolderRenamed += FolderRenamed; hh.DocumentRenamed += DocumentRenamed; hierarchyHandlers.Add(cn, hh); }
internal String GetCanonicalName() { string canonicalName = null; ErrorHandler.ThrowOnFailure(_hierarchy.GetCanonicalName(_vsitemid, out canonicalName), VSConstants.E_NOTIMPL); return(canonicalName); }
/// <summary> /// Get the canonical name /// </summary> private static string GetCanonicalName(uint itemId, IVsHierarchy hierarchy) { Debug.Assert(itemId != VSConstants.VSITEMID_NIL, "ItemId cannot be nill"); string strRet = string.Empty; if (ErrorHandler.Failed(hierarchy.GetCanonicalName(itemId, out strRet))) { return string.Empty; } return strRet; }
/// <summary> /// This is used to determine project and file information for a hierarchy node /// </summary> /// <param name="hierarchy">The hierarchy node to examine</param> /// <param name="itemId">The item ID</param> /// <remarks>This filters out the root solution node, project nodes, folder nodes, and any other /// unrecognized nodes.</remarks> private static SpellCheckFileInfo DetermineProjectFileInformation(IVsHierarchy hierarchy, uint itemId) { Guid guid; int result; object value; string projectName = "", name, canonicalName; var project = hierarchy as IVsProject; if (project != null) { result = project.GetMkDocument(VSConstants.VSITEMID_ROOT, out projectName); // If there is no project name, it's probably a solution item if (result != VSConstants.S_OK) { projectName = "Solution Items"; } else if (projectName.Length > 1 && projectName[projectName.Length - 1] == '\\') { projectName += Path.GetFileName(projectName.Substring(0, projectName.Length - 1)); } result = hierarchy.GetProperty(itemId, (int)__VSHPROPID.VSHPROPID_Name, out value); if (result == VSConstants.S_OK && value != null) { name = value.ToString(); // Certain project folders in C++ projects return a GUID for their name. These should be // ignored (References, External Dependencies, etc.). if (name.Length != 0 && name[0] == '{' && Guid.TryParse(name, out guid)) { return(IgnoredHierarchyItem); } result = hierarchy.GetCanonicalName(itemId, out canonicalName); if (result == VSConstants.S_OK && !String.IsNullOrWhiteSpace(canonicalName) && canonicalName.IndexOfAny(Path.GetInvalidPathChars()) == -1 && Path.IsPathRooted(canonicalName) && !canonicalName.EndsWith("\\", StringComparison.Ordinal) && !canonicalName.Equals(projectName, StringComparison.OrdinalIgnoreCase)) { return(new SpellCheckFileInfo { ProjectFile = projectName, Filename = name, CanonicalName = canonicalName }); } } } return(null); }
public static string GetFileNameFromHierarchy(IVsHierarchy hierarchy) { string fileName; var itemId = GetItemId(hierarchy); hierarchy.GetCanonicalName(itemId, out fileName); return fileName; }
private static bool TryGetFile(IVsHierarchy hierarchy, uint itemid, out string file) { if (hierarchy != null && hierarchy.GetCanonicalName(itemid, out file) == VSConstants.S_OK && file != null && File.Exists(file)) { return(true); } file = null; return(false); }
/// <summary> /// Get the canonical name /// </summary> private static string GetCanonicalName(uint itemId, IVsHierarchy hierarchy) { Debug.Assert(itemId != VSConstants.VSITEMID_NIL, "ItemId cannot be nill"); string strRet = string.Empty; if (ErrorHandler.Failed(hierarchy.GetCanonicalName(itemId, out strRet))) { return(string.Empty); } return(strRet); }
int IVsSelectionEvents.OnSelectionChanged(IVsHierarchy pHierOld, uint itemidOld, IVsMultiItemSelect pMISOld, ISelectionContainer pSCOld, IVsHierarchy pHierNew, uint itemidNew, IVsMultiItemSelect pMISNew, ISelectionContainer pSCNew) { // No-op on multi-selection. if (pMISNew == null && pHierNew != null && pHierNew.GetCanonicalName(itemidNew, out var path) == 0) { UpdateStartupFile(path); } return(0); }
public static string GetCanonicalName(this IVsHierarchy hierarchy, uint itemId) { try { string pbstrName; if (hierarchy.GetCanonicalName(itemId, out pbstrName) == 0) { return(pbstrName); } } catch (Exception) { } return(""); }
/// <summary> /// Handle project addition/deletion cases. The way these parameters work is: /// pHierarchy: Pointer to the IVsHierarchy interface of the project being loaded or closed. /// fAddedRemoved: For addition, true if the project is added to the solution after the /// solution is opened, false if the project is added to the solution while /// the solution is being opened. For deletion, true if the project was /// removed from the solution before the solution was closed, false if the /// project was removed from the solution while the solution was being /// closed. /// type: FileEventType.FileAdded - project addition, FileEventType.FileDeleted - project /// deletion. /// TODO: may process files in parallel /// </summary> /// <param name="pHierarchy"></param> /// <param name="fAddedRemoved"></param> /// <param name="type"></param> public void NotifyProjectAddRemove(IVsHierarchy pHierarchy, int fAddedRemoved, FileEventType type) { List <string> fileList = new List <string>(); string projectName; pHierarchy.GetCanonicalName(VSConstants.VSITEMID_ROOT, out projectName); //SrcMLFileLogger.DefaultLogger.Info("Project Name: [" + projectName + "]"); // Find out this project in the solution tree var allProjects = OpenSolution.getProjects(); var enumerator = allProjects.GetEnumerator(); while (enumerator.MoveNext()) { Project project = enumerator.Current as Project; string fullName = null; try { //SrcMLFileLogger.DefaultLogger.Info("FileName: [" + project.FileName + "]"); fullName = project.FileName; } catch (Exception e) { // Ignore unloaded project. It would cause a Not Implemented Exception for an // unloaded project. //SrcMLFileLogger.DefaultLogger.Error(SrcMLExceptionFormatter.CreateMessage(e, "Exception in SolutionMonitor.NotifyProjectAddRemove() - ")); continue; } if (fullName != null && (fullName.Equals(projectName) || fullName.ToLower().Contains(projectName.ToLower()))) { SrcMLFileLogger.DefaultLogger.Info("Project: [" + projectName + "]"); ProcessProject(project, null, fileList); break; } } // Generate or delete srcML files for the source files in this project try { foreach (var filePath in fileList) { if (FileEventType.FileAdded.Equals(type)) { //SrcMLFileLogger.DefaultLogger.Info(">>> AddFile(" + filePath + ")"); AddFile(filePath); } else if (FileEventType.FileDeleted.Equals(type)) { //SrcMLFileLogger.DefaultLogger.Info(">>> DeleteFile(" + filePath + ")"); DeleteFile(filePath); } } } catch (Exception e) { SrcMLFileLogger.DefaultLogger.Error(SrcMLExceptionFormatter.CreateMessage(e, "Exception when batch adding or deleting srcML files for a specified project.")); } }
private void CollapseHierarchyItems(IVsUIHierarchyWindow toolWindow, IVsHierarchy hierarchy, uint itemid, bool hierIsSolution , string[] captions) { IntPtr ptr; uint num2; Guid gUID = typeof(IVsHierarchy).GUID; if ((hierarchy.GetNestedHierarchy(itemid, ref gUID, out ptr, out num2) == 0) && (IntPtr.Zero != ptr)) { IVsHierarchy objectForIUnknown = Marshal.GetObjectForIUnknown(ptr) as IVsHierarchy; Marshal.Release(ptr); if (objectForIUnknown != null) { this.CollapseHierarchyItems(toolWindow, objectForIUnknown, num2, false, captions); } } else { object obj2; if (!hierIsSolution) { string canonicalname; object captionobj; hierarchy.GetProperty(itemid, (int)__VSHPROPID.VSHPROPID_Caption, out captionobj); var caption = (string)captionobj; if (captions.Contains(caption)) { hierarchy.GetCanonicalName(itemid, out canonicalname); ErrorHandler.ThrowOnFailure(toolWindow.ExpandItem(hierarchy as IVsUIHierarchy, itemid, EXPANDFLAGS.EXPF_CollapseFolder)); } } if (hierarchy.GetProperty(itemid, (int)__VSHPROPID.VSHPROPID_FirstVisibleChild, out obj2) == 0) { uint itemId = this.GetItemId(obj2); while (itemId != uint.MaxValue) { this.CollapseHierarchyItems(toolWindow, hierarchy, itemId, false, captions); int hr = hierarchy.GetProperty(itemId, (int)__VSHPROPID.VSHPROPID_NextVisibleSibling, out obj2); if (hr == 0) { itemId = this.GetItemId(obj2); } else { ErrorHandler.ThrowOnFailure(hr); return; } } } } }
public static bool TryGetFileName(IVsHierarchy hierarchy, uint itemID, out string fileName) { if (hierarchy != null) { string value; if (ErrorHandler.Succeeded(hierarchy.GetCanonicalName(itemID, out value))) { fileName = value; return(true); } } fileName = null; return(false); }
private void RemoveTasks(IVsHierarchy aHierarchy) { for (int i = mErrorProvider.Tasks.Count - 1; i >= 0; --i) { var errorTask = mErrorProvider.Tasks[i] as ErrorTask; aHierarchy.GetCanonicalName(Microsoft.VisualStudio.VSConstants.VSITEMID_ROOT, out string nameInHierarchy); errorTask.HierarchyItem.GetCanonicalName(Microsoft.VisualStudio.VSConstants.VSITEMID_ROOT, out string nameErrorTaskHierarchy); if (nameInHierarchy == nameErrorTaskHierarchy) { errorTask.Navigate -= ErrorTaskNavigate; mErrorProvider.Tasks.Remove(errorTask); } } }
public static bool TryGetFileName(IVsHierarchy hierarchy, uint itemID, out string fileName) { if (hierarchy != null) { string value; if (ErrorHandler.Succeeded(hierarchy.GetCanonicalName(itemID, out value))) { fileName = value; return true; } } fileName = null; return false; }
// 道具添加 public int OnItemAdded(uint itemidParent, uint itemidSiblingPrev, uint itemidAdded) { if (m_file_icon != null) { m_project.SetProperty(itemidAdded, (int)__VSHPROPID.VSHPROPID_IconIndex, m_file_icon.Handle); } string name; m_project.GetCanonicalName(itemidAdded, out name); var server = m_solution.GetServer(); if (server != null) { server.AddTask(() => server.AddFileItem(m_path, name, itemidAdded)); } if (m_view_map.TryGetValue(itemidAdded, out UIViewItem item)) { item.CheckFullPath(); } return(VSConstants.S_OK); }
// // Explore a single item in a hierarchy (project) and flag any associated Epoch code. // // Does not directly parse the code; instead the filename is added to a collection for // later consumption by the parser driver itself (see ParseIfOutdated). This permits a // caller to deduplicate parsing requests. // private void ParseHierarchyItem(IVsHierarchy hierarchy, uint itemId, HashSet <string> filenames) { ThreadHelper.ThrowIfNotOnUIThread(); string canonicalName = null; int result = hierarchy.GetCanonicalName(itemId, out canonicalName); if (!string.IsNullOrEmpty(canonicalName)) { if (canonicalName.EndsWith(".epoch", StringComparison.CurrentCultureIgnoreCase)) { filenames.Add(canonicalName); } } }
int IVsEditorFactory.CreateEditorInstance(uint grfCreateDoc, string pszMkDocument, string pszPhysicalView, IVsHierarchy pvHier, uint itemid, IntPtr punkDocDataExisting, out IntPtr ppunkDocView, out IntPtr ppunkDocData, out string pbstrEditorCaption, out Guid pguidCmdUI, out int pgrfCDW) { string s; pvHier.GetCanonicalName(itemid, out s); pgrfCDW = 0; LastDocumentPath = pszMkDocument; pguidCmdUI = VSConstants.GUID_TextEditorFactory; SqlEditorPane editor = new SqlEditorPane(serviceProvider, this); ppunkDocData = Marshal.GetIUnknownForObject(editor.Window); ppunkDocView = Marshal.GetIUnknownForObject(editor); pbstrEditorCaption = ""; return VSConstants.S_OK; }
static void ShowNodeName(IVsHierarchy hierarchy, uint itemId) { int result; object value = null; string name = ""; string canonicalName = ""; result = hierarchy.GetProperty(itemId, (int)__VSHPROPID.VSHPROPID_Name, out value); if (result == VSConstants.S_OK && value != null) { name = value.ToString(); } result = hierarchy.GetCanonicalName(itemId, out canonicalName); var res = "Name: " + name + "\r\n" + "Canonical name: " + canonicalName; if (res == null) return; }
private static ProjectReferenceNode GetProjectReferenceOnNodeForHierarchy(IList<ReferenceNode> references, IVsHierarchy inputHierarchy) { if(references == null) return null; Guid projectGuid; // !EFW - This is an odd one. Open a file not contained within a project in the active solution and // then close it. When you do, this method is called and it fails here. The file is hosted in the // Miscellaneous Files hierarchy. In such cases, we'll just ignore it and return null. if(inputHierarchy.GetGuidProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ProjectIDGuid, out projectGuid) != VSConstants.S_OK) return null; string canonicalName; ErrorHandler.ThrowOnFailure(inputHierarchy.GetCanonicalName(VSConstants.VSITEMID_ROOT, out canonicalName)); foreach(ReferenceNode refNode in references) { ProjectReferenceNode projRefNode = refNode as ProjectReferenceNode; if(projRefNode != null) { if(projRefNode.ReferencedProjectGuid == projectGuid) return projRefNode; // Try with canonical names, if the project that is removed is an unloaded project that the // above criteria will not pass. if(!String.IsNullOrEmpty(projRefNode.Url) && NativeMethods.IsSamePath(projRefNode.Url, canonicalName)) return projRefNode; } } return null; }
/// <summary> /// This is used to determine project and file information for a hierarchy node /// </summary> /// <param name="hierarchy">The hierarchy node to examine</param> /// <param name="itemId">The item ID</param> /// <remarks>This filters out the root solution node, project nodes, folder nodes, and any other /// unrecognized nodes.</remarks> private static SpellCheckFileInfo DetermineProjectFileInformation(IVsHierarchy hierarchy, uint itemId) { int result; object value; string projectName = "", name, canonicalName; var project = hierarchy as IVsProject; if(project != null) { result = project.GetMkDocument(VSConstants.VSITEMID_ROOT, out projectName); // If there is no project name, it's probably a solution item if(result != VSConstants.S_OK) projectName = "Solution Items"; else if(projectName.Length > 1 && projectName[projectName.Length - 1] == '\\') projectName += Path.GetFileName(projectName.Substring(0, projectName.Length - 1)); result = hierarchy.GetProperty(itemId, (int)__VSHPROPID.VSHPROPID_Name, out value); if(result == VSConstants.S_OK && value != null) { name = value.ToString(); result = hierarchy.GetCanonicalName(itemId, out canonicalName); if(result == VSConstants.S_OK && !String.IsNullOrWhiteSpace(canonicalName) && canonicalName.IndexOfAny(Path.GetInvalidPathChars()) == -1 && Path.IsPathRooted(canonicalName) && !canonicalName.EndsWith("\\", StringComparison.Ordinal) && !canonicalName.Equals(projectName, StringComparison.OrdinalIgnoreCase)) { return new SpellCheckFileInfo { ProjectFile = projectName, Filename = name, CanonicalName = canonicalName }; } } } return null; }
/// <summary> /// Handle project addition/deletion cases. The way these parameters work is: /// pHierarchy: Pointer to the IVsHierarchy interface of the project being loaded or closed. /// fAddedRemoved: For addition, true if the project is added to the solution after the /// solution is opened, false if the project is added to the solution while /// the solution is being opened. For deletion, true if the project was /// removed from the solution before the solution was closed, false if the /// project was removed from the solution while the solution was being /// closed. /// type: FileEventType.FileAdded - project addition, FileEventType.FileDeleted - project /// deletion. /// TODO: may process files in parallel /// </summary> /// <param name="pHierarchy"></param> /// <param name="fAddedRemoved"></param> /// <param name="type"></param> public void NotifyProjectAddRemove(IVsHierarchy pHierarchy, int fAddedRemoved, FileEventType type) { List<string> fileList = new List<string>(); string projectName; pHierarchy.GetCanonicalName(VSConstants.VSITEMID_ROOT, out projectName); //SrcMLFileLogger.DefaultLogger.Info("Project Name: [" + projectName + "]"); // Find out this project in the solution tree var allProjects = OpenSolution.getProjects(); var enumerator = allProjects.GetEnumerator(); while(enumerator.MoveNext()) { Project project = enumerator.Current as Project; string fullName = null; try { //SrcMLFileLogger.DefaultLogger.Info("FileName: [" + project.FileName + "]"); fullName = project.FileName; } catch(Exception e) { // Ignore unloaded project. It would cause a Not Implemented Exception for an // unloaded project. //SrcMLFileLogger.DefaultLogger.Error(SrcMLExceptionFormatter.CreateMessage(e, "Exception in SolutionMonitor.NotifyProjectAddRemove() - ")); continue; } if(fullName != null && (fullName.Equals(projectName) || fullName.ToLower().Contains(projectName.ToLower()))) { SrcMLFileLogger.DefaultLogger.Info("Project: [" + projectName + "]"); ProcessProject(project, null, fileList); break; } } // Generate or delete srcML files for the source files in this project try { foreach(var filePath in fileList) { if(FileEventType.FileAdded.Equals(type)) { //SrcMLFileLogger.DefaultLogger.Info(">>> AddFile(" + filePath + ")"); AddFile(filePath); } else if(FileEventType.FileDeleted.Equals(type)) { //SrcMLFileLogger.DefaultLogger.Info(">>> DeleteFile(" + filePath + ")"); DeleteFile(filePath); } } } catch(Exception e) { SrcMLFileLogger.DefaultLogger.Error(SrcMLExceptionFormatter.CreateMessage(e, "Exception when batch adding or deleting srcML files for a specified project.")); } }
private string GetSelectedFileFullPath(uint itemid, IVsHierarchy hierarchy) { string filePath; hierarchy.GetCanonicalName(itemid, out filePath); return filePath; }
/// <summary> /// This function diplays the name of the Hierarchy node. This function is passed to the /// Hierarchy enumeration routines to process the current node. /// </summary> /// <param name="hierarchy">Hierarchy of the current node</param> /// <param name="itemid">Itemid of the current node</param> /// <param name="recursionLevel">Depth of recursion in hierarchy enumeration. We add one tab /// for each level in the recursion.</param> private void ProcessSolutionNode(IVsHierarchy hierarchy, uint itemid, int recursionLevel) { int hr; // get name object objName; hr = hierarchy.GetProperty(itemid, (int)__VSHPROPID.VSHPROPID_Name, out objName); if (recursionLevel == 0) traversalState.CurrentSolutionName = (string)objName; if (recursionLevel == 1) traversalState.CurrentProjectName = (string)objName; // skip non-member items (dependencies, files not referenced by the solution) object objIsNonMember; hr = hierarchy.GetProperty(itemid, (int)__VSHPROPID.VSHPROPID_IsNonMemberItem, out objIsNonMember); if (objIsNonMember != null) if ((bool)objIsNonMember) return; SolutionFile sr = new SolutionFile(); sr.Name = (string)objName; sr.Project = traversalState.CurrentProjectName; sr.ItemId = itemid; // get canonical filename and last write time if (recursionLevel > 0 && itemid != VSConstants.VSITEMID_NIL && itemid != VSConstants.VSITEMID_ROOT) { try { string filePath = ""; if (hierarchy.GetCanonicalName(itemid, out filePath) == VSConstants.S_OK) { if (!string.IsNullOrEmpty(filePath) && System.IO.Path.IsPathRooted(filePath)) { if (File.Exists(filePath)) { sr.FilePath = filePath; sr.LastWriteTime = File.GetLastWriteTime(filePath); } } } } catch (ArgumentException) { } catch (System.Reflection.TargetInvocationException) { } catch (Exception) { } } // Exclude empty names and paths (also non-existent files). if (string.IsNullOrEmpty(sr.Name) || string.IsNullOrEmpty(sr.FilePath)) return; // Exclude canonical names that appear to be directories if (sr.FilePath.EndsWith("\\") || sr.FilePath.EndsWith("/")) return; // get icon object objIconIndex; hr = hierarchy.GetProperty(itemid, (int)__VSHPROPID.VSHPROPID_IconIndex, out objIconIndex); if (objIconIndex != null) sr.IconIndex = (int)objIconIndex; // TODO: look how to obtain item's icons for display in the list view // -> http://connect.microsoft.com/VisualStudio/feedback/details/520256/cannot-find-icon-for-vs2010-database-project solutionFiles.Add(sr); }
private string GetProjectFileName(IVsHierarchy hierHierarchy) { if (!(hierHierarchy is IVsSccProject2)) return GetSolutionFileName(); var files = GetNodeFiles(hierHierarchy as IVsSccProject2, VSConstants.VSITEMID_ROOT); string fileName = files.Count <= 0 ? null : files[0]; //try hierHierarchy.GetCanonicalName to get project name for web site if (fileName == null) { if (hierHierarchy.GetCanonicalName(VSConstants.VSITEMID_ROOT, out fileName) != VSConstants.S_OK) return null; return GetCaseSensitiveFileName(fileName); } return fileName; }
private string GetFileName(IVsHierarchy hierHierarchy, uint itemidNode) { if (itemidNode == VSConstants.VSITEMID_ROOT) { if (hierHierarchy == null) return GetSolutionFileName(); else return GetProjectFileName(hierHierarchy); } else { string fileName = null; if (hierHierarchy.GetCanonicalName(itemidNode, out fileName) != VSConstants.S_OK) return null; return GetCaseSensitiveFileName(fileName); } }
/// <summary> /// Updates the ServiceDefinition.csdef file in /// <paramref name="project"/> to include the default startup and /// runtime tasks for Python projects. /// </summary> /// <param name="project"> /// The Cloud Service project to update. /// </param> /// <param name="roleType"> /// The type of role being added, either "Web" or "Worker". /// </param> /// <param name="projectName"> /// The name of the role. This typically matches the Caption property. /// </param> /// <param name="site"> /// VS service provider. /// </param> internal static void UpdateServiceDefinition( IVsHierarchy project, string roleType, string projectName, System.IServiceProvider site ) { Utilities.ArgumentNotNull("project", project); object obj; ErrorHandler.ThrowOnFailure(project.GetProperty( (uint)VSConstants.VSITEMID.Root, (int)__VSHPROPID.VSHPROPID_FirstChild, out obj )); uint id; while (TryGetItemId(obj, out id)) { Guid itemType; string mkDoc; if (ErrorHandler.Succeeded(project.GetGuidProperty(id, (int)__VSHPROPID.VSHPROPID_TypeGuid, out itemType)) && itemType == VSConstants.GUID_ItemType_PhysicalFile && ErrorHandler.Succeeded(project.GetProperty(id, (int)__VSHPROPID.VSHPROPID_Name, out obj)) && "ServiceDefinition.csdef".Equals(obj as string, StringComparison.InvariantCultureIgnoreCase) && ErrorHandler.Succeeded(project.GetCanonicalName(id, out mkDoc)) && !string.IsNullOrEmpty(mkDoc) ) { // We have found the file var rdt = site.GetService(typeof(SVsRunningDocumentTable)) as IVsRunningDocumentTable; IVsHierarchy docHier; uint docId, docCookie; IntPtr pDocData; bool updateFileOnDisk = true; if (ErrorHandler.Succeeded(rdt.FindAndLockDocument( (uint)_VSRDTFLAGS.RDT_EditLock, mkDoc, out docHier, out docId, out pDocData, out docCookie ))) { try { if (pDocData != IntPtr.Zero) { try { // File is open, so edit it through the document UpdateServiceDefinition( Marshal.GetObjectForIUnknown(pDocData) as IVsTextLines, roleType, projectName ); ErrorHandler.ThrowOnFailure(rdt.SaveDocuments( (uint)__VSRDTSAVEOPTIONS.RDTSAVEOPT_ForceSave, docHier, docId, docCookie )); updateFileOnDisk = false; } catch (ArgumentException) { } catch (InvalidOperationException) { } catch (COMException) { } finally { Marshal.Release(pDocData); } } } finally { ErrorHandler.ThrowOnFailure(rdt.UnlockDocument( (uint)_VSRDTFLAGS.RDT_Unlock_SaveIfDirty | (uint)_VSRDTFLAGS.RDT_RequestUnlock, docCookie )); } } if (updateFileOnDisk) { // File is not open, so edit it on disk FileStream stream = null; try { UpdateServiceDefinition(mkDoc, roleType, projectName); } finally { if (stream != null) { stream.Close(); } } } break; } if (ErrorHandler.Failed(project.GetProperty(id, (int)__VSHPROPID.VSHPROPID_NextSibling, out obj))) { break; } } }
//[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 (ErrorHandler.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 != VSConstants.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; if (ErrorHandler.Succeeded(project.GetMkDocument(id, out mkDocument))) { if (!IsValidPath(mkDocument)) files = new string[0]; else files = new string[] { mkDocument }; return true; } 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 (ErrorHandler.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; } } }
private async Task<string> GetFileName(IVsHierarchy hierHierarchy, uint itemidNode) { if (itemidNode == VSConstants.VSITEMID_ROOT) { if (hierHierarchy == null) return await GetSolutionFileName(); else return await GetProjectFileName(hierHierarchy); } else { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); string fileName = null; if (hierHierarchy.GetCanonicalName(itemidNode, out fileName) != VSConstants.S_OK) return null; return GetCaseSensitiveFileName(fileName); } }
private static ProjectReferenceNode GetProjectReferenceOnNodeForHierarchy(IList<ReferenceNode> references, IVsHierarchy inputHierarchy) { if (references == null) { return null; } Guid projectGuid; ErrorHandler.ThrowOnFailure(inputHierarchy.GetGuidProperty(VSConstants.VSITEMID_ROOT, (int) __VSHPROPID.VSHPROPID_ProjectIDGuid, out projectGuid)); string canonicalName; ErrorHandler.ThrowOnFailure(inputHierarchy.GetCanonicalName(VSConstants.VSITEMID_ROOT, out canonicalName)); foreach (var refNode in references) { var projRefNode = refNode as ProjectReferenceNode; if (projRefNode != null) { if (projRefNode.ReferencedProjectGuid == projectGuid) { return projRefNode; } // Try with canonical names, if the project that is removed is an unloaded project than the above criteria will not pass. if (!string.IsNullOrEmpty(projRefNode.Url) && NativeMethods.IsSamePath(projRefNode.Url, canonicalName)) { return projRefNode; } } } return null; }
int IVsSelectionEvents.OnSelectionChanged(IVsHierarchy pHierOld, uint itemidOld, IVsMultiItemSelect pMISOld, ISelectionContainer pSCOld, IVsHierarchy pHierNew, uint itemidNew, IVsMultiItemSelect pMISNew, ISelectionContainer pSCNew) { SelectedGraphNode = GetCurrentSelectionGraphNode(pSCNew); SelectedFileName = null; if (pHierNew != null) { string itemName; pHierNew.GetCanonicalName(itemidNew, out itemName); if (itemName != null) SelectedFileName = itemName.ToString(); } return VSConstants.S_OK; }
public static async Task<string> GetProjectFileName(IVsHierarchy hierHierarchy) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); if (!(hierHierarchy is IVsSccProject2)) return await GetSolutionFileName(); var files = await GetNodeFiles(hierHierarchy as IVsSccProject2, VSConstants.VSITEMID_ROOT); string fileName = files.Count <= 0 ? null : files[0]; //try hierHierarchy.GetCanonicalName to get project name for web site if (fileName == null) { if (hierHierarchy.GetCanonicalName(VSConstants.VSITEMID_ROOT, out fileName) != VSConstants.S_OK) return null; return GetCaseSensitiveFileName(fileName); } return fileName; }
private void ProcessHierarchyNode(IVsHierarchy hierarchy, uint itemid) { int hr; // Canonical Name string canonicalName; hr = hierarchy.GetCanonicalName(itemid, out canonicalName); // Project Name object projectName; ErrorHandler.ThrowOnFailure(hierarchy.GetProperty(itemid, (int)__VSHPROPID.VSHPROPID_Name, out projectName)); // Project GUID Guid projectGuid; hr = hierarchy.GetGuidProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ProjectIDGuid, out projectGuid); if (Guid.Empty == projectGuid) // in case when project is unloaded _projectNames.TryGetValue(canonicalName, out projectGuid); // Project Icon var icon = RetrieveProjectIcon(hierarchy); // Load Priority var loadPriority = RetrieveProjectLoadPriority(projectGuid); if (null == _rootProject) { _rootProject = _lastProject = new ProjectInfo((String)projectName, projectGuid, loadPriority, null) { Icon = icon }; } else { _lastProject = new ProjectInfo((String)projectName, projectGuid, loadPriority, _currentProject) { Icon = icon }; _currentProject.Children.Add(_lastProject); } }
int IVsSelectionEvents.OnSelectionChanged(IVsHierarchy pHierOld, uint itemidOld,IVsMultiItemSelect pMISOld, ISelectionContainer pSCOld,IVsHierarchy pHierNew, uint itemidNew,IVsMultiItemSelect pMISNew, ISelectionContainer pSCNew) { if (pHierNew != null) { string itemName; //pHierNew.GetProperty(itemidNew, (int)__VSHPROPID.VSHPROPID_Name, out itemName); pHierNew.GetCanonicalName(itemidNew, out itemName); bool activectx = itemName != null && (itemName.ToString().Contains("Views") ||itemName.ToString().Contains("views")); if (activectx) { object temp; hierarchy = pHierNew; pHierNew.GetProperty(VSConstants.VSITEMID_ROOT,(int)__VSHPROPID.VSHPROPID_ProjectDir, out temp); projectDir = temp.ToString(); //root = projectFullName.Substring(0, projectFullName.LastIndexOf('\\') + 1); pHierNew.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ProjectName, out temp); projectName = temp.ToString(); viewsFolderName = itemName.ToString(); } int factive = (activectx)? 1 : 0; SelectionService.SetCmdUIContext(contextCookie, factive); } return VSConstants.S_OK; }
/// <summary> /// Reports that the project hierarchy, item and/or selection container has changed. /// </summary> /// <returns> /// If the method succeeds, it returns <see cref="F:Microsoft.VisualStudio.VSConstants.S_OK"/>. If it fails, it returns an error code. /// </returns> /// <param name="pHierOld">[in] Pointer to the <see cref="T:Microsoft.VisualStudio.Shell.Interop.IVsHierarchy"/> interface of the project hierarchy for the previous selection.</param><param name="itemidOld">[in] Identifier of the project item for previous selection. For valid <paramref name="itemidOld"/> values, see VSITEMID.</param><param name="pMISOld">[in] Pointer to the <see cref="T:Microsoft.VisualStudio.Shell.Interop.IVsMultiItemSelect"/> interface to access a previous multiple selection.</param><param name="pSCOld">[in] Pointer to the <see cref="T:Microsoft.VisualStudio.Shell.Interop.ISelectionContainer"/> interface to access Properties window data for the previous selection.</param><param name="pHierNew">[in] Pointer to the <see cref="T:Microsoft.VisualStudio.Shell.Interop.IVsHierarchy"/> interface of the project hierarchy for the current selection.</param><param name="itemidNew">[in] Identifier of the project item for the current selection. For valid <paramref name="itemidNew"/> values, see VSITEMID.</param><param name="pMISNew">[in] Pointer to the <see cref="T:Microsoft.VisualStudio.Shell.Interop.IVsMultiItemSelect"/> interface for the current selection.</param><param name="pSCNew">[in] Pointer to the <see cref="T:Microsoft.VisualStudio.Shell.Interop.ISelectionContainer"/> interface for the current selection.</param> public int OnSelectionChanged(IVsHierarchy pHierOld, uint itemidOld, IVsMultiItemSelect pMISOld, ISelectionContainer pSCOld, IVsHierarchy pHierNew, uint itemidNew, IVsMultiItemSelect pMISNew, ISelectionContainer pSCNew) { string fullPath = ""; if (pHierNew != null) { // Get the full path pHierNew.GetCanonicalName(itemidNew, out fullPath); } //if path is null, get it from solution level if (string.IsNullOrEmpty(fullPath)) { fullPath = getSolutionFileName(); } var directory = Path.GetDirectoryName(fullPath); //set the current dir var so we can use it in other parts of the service currentDir = directory; // Setup the rake menu for this path //setupRakeTasksMenu(directory); return VSConstants.S_OK; }