Skip to content

Commit

Permalink
getSolutionExplorer bug fix
Browse files Browse the repository at this point in the history
git-svn-id: https://fsprojectextender.svn.codeplex.com/svn@45651 0e2699bc-83d4-4a8f-98e7-55e24ab8c7a5
  • Loading branch information
SND\svlasova_cp authored and SND\svlasova_cp committed May 20, 2010
1 parent 8998ac4 commit 4b9b67b
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 21 deletions.
24 changes: 17 additions & 7 deletions trunk/ProjectExtender/GlobalServices.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio;
Expand All @@ -16,14 +18,22 @@ static class GlobalServices

public static readonly IVsTrackProjectDocuments2 documentTracker = (IVsTrackProjectDocuments2)Package.GetGlobalService(typeof(SVsTrackProjectDocuments));

public static readonly IVsUIHierarchyWindow solutionExplorer = getSolutionExplorer();

public static readonly IVsUIShell shell = (IVsUIShell)Package.GetGlobalService(typeof(SVsUIShell));

public static readonly IVsSolution solution = (IVsSolution)Package.GetGlobalService(typeof(SVsSolution));
public static IVsSolution solution = (IVsSolution)Package.GetGlobalService(typeof(SVsSolution));

public static readonly EnvDTE.DTE dte = (EnvDTE.DTE)Package.GetGlobalService(typeof(SDTE));

public static IVsUIHierarchyWindow SolutionExplorer
{
get
{
return getSolutionExplorer();
}
}


/// <summary>
/// retrieves the IVsProject interface for currentll selected project
/// </summary>
Expand Down Expand Up @@ -166,15 +176,15 @@ private static IVsTrackSelectionEx get_selectionTracker()
private static IVsUIHierarchyWindow getSolutionExplorer()
{
IVsUIShell shell = Package.GetGlobalService(typeof(SVsUIShell)) as IVsUIShell;

object pvar = null;
IVsWindowFrame frame = null;
Guid persistenceSlot = new Guid(EnvDTE.Constants.vsWindowKindSolutionExplorer);

ErrorHandler.ThrowOnFailure(shell.FindToolWindow(0, ref persistenceSlot, out frame));
ErrorHandler.ThrowOnFailure(frame.GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out pvar));

if (ErrorHandler.Succeeded(shell.FindToolWindow(0, ref persistenceSlot, out frame)))
{
ErrorHandler.ThrowOnFailure(frame.GetProperty((int)__VSFPROPID.VSFPROPID_DocView, out pvar));
}
return (IVsUIHierarchyWindow)pvar;

}

}
Expand Down
5 changes: 4 additions & 1 deletion trunk/ProjectExtender/ProjectExtender2010.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants>TRACE;CODE_ANALYSIS;VS2010</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<RunCodeAnalysis>true</RunCodeAnalysis>
Expand All @@ -39,6 +39,9 @@
<Reference Include="FSharp.ProjectSystem.Base, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<Reference Include="FSharp.ProjectSystem.FSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\..\WINDOWS\Microsoft.NET\assembly\GAC_MSIL\FSharp.ProjectSystem.FSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\FSharp.ProjectSystem.FSharp.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Build" />
<Reference Include="Microsoft.Build.Engine" />
<Reference Include="Microsoft.Build.Framework" />
Expand Down
5 changes: 5 additions & 0 deletions trunk/ProjectExtender/ProjectExtenderPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ namespace FSharp.ProjectExtender
[DefaultRegistryRoot("Software\\Microsoft\\VisualStudio\\9.0")]
// This attribute is used to register the informations needed to show the this package
// in the Help/About dialog of Visual Studio.
#if VS2008
[InstalledProductRegistration(false, "#110", "#112", "1.0", IconResourceID = 400)]
#endif
#if VS2010
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]
#endif
// This attribute is needed to let the shell know that this package exposes some menus.
[ProvideMenuResource(1000, 1)]
// In order be loaded inside Visual Studio in a machine that has not the VS SDK installed,
Expand Down
27 changes: 17 additions & 10 deletions trunk/ProjectExtender/ProjectManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,10 @@ internal void InvalidateParentItems(IEnumerable<uint> itemIds)
uint lastItemId = projectProxy.InvalidateParentItems(itemIds);

if (lastItemId != VSConstants.VSITEMID_NIL)
GlobalServices.solutionExplorer.ExpandItem(this, lastItemId, EXPANDFLAGS.EXPF_SelectItem);

{
if (GlobalServices.SolutionExplorer != null)
GlobalServices.SolutionExplorer.ExpandItem(this, lastItemId, EXPANDFLAGS.EXPF_SelectItem);
}
}

private void InvalidateParentItems(string[] oldFileNames, string[] newFileNames)
Expand Down Expand Up @@ -243,14 +245,19 @@ public void RefreshSolutionExplorer(IEnumerable<ItemNode> nodes)
projectProxy.RefreshSolutionExplorer();

bool first = true;
foreach (var node in itemList.RemapNodes(nodes))
if (first)
{
GlobalServices.solutionExplorer.ExpandItem(this, node.ItemId, EXPANDFLAGS.EXPF_SelectItem);
first = false;
}
else
GlobalServices.solutionExplorer.ExpandItem(this, node.ItemId, EXPANDFLAGS.EXPF_AddSelectItem);
IVsUIHierarchyWindow explorer = GlobalServices.SolutionExplorer;
if (explorer != null)
{
foreach (var node in itemList.RemapNodes(nodes))
if (first)
{
explorer.ExpandItem(this, node.ItemId, EXPANDFLAGS.EXPF_SelectItem);
first = false;
}
else
explorer.ExpandItem(this, node.ItemId, EXPANDFLAGS.EXPF_AddSelectItem);
}

}


Expand Down
2 changes: 1 addition & 1 deletion trunk/ProjectExtender/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Name>F# Project System Extender</Name>
<Author>Hill30 Inc</Author>
<Version>1.0</Version>
<Description xml:space="preserve">Information about my package</Description>
<Description xml:space="preserve">Extends F# project system</Description>
<Locale>1033</Locale>
<InstalledByMsi>false</InstalledByMsi>
<SupportedProducts>
Expand Down
10 changes: 8 additions & 2 deletions trunk/ProjectExtenderSetup/ProjectExtenderSetup.wixproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<SchemaVersion>2.0</SchemaVersion>
<OutputName>ProjectExtenderSetup</OutputName>
<OutputType>Package</OutputType>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.0\Wix.targets</WixTargetsPath>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.0\Wix.targets</WixTargetsPath>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.5\Wix.targets</WixTargetsPath>
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.5\Wix.targets</WixTargetsPath>
<Name>ProjectExtenderSetup</Name>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
Expand Down Expand Up @@ -37,12 +37,15 @@
<ItemGroup>
<WixExtension Include="WixUtilExtension">
<HintPath>$(WixExtDir)\WixUtilExtension.dll</HintPath>
<Name>WixUtilExtension</Name>
</WixExtension>
<WixExtension Include="WixUIExtension">
<HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
<Name>WixUIExtension</Name>
</WixExtension>
<WixExtension Include="WixNetFxExtension">
<HintPath>$(WixExtDir)\WixNetFxExtension.dll</HintPath>
<Name>WixNetFxExtension</Name>
</WixExtension>
</ItemGroup>
<Import Project="$(WixTargetsPath)" />
Expand All @@ -54,4 +57,7 @@
<Target Name="AfterBuild">
</Target>
-->
<PropertyGroup>
<PostBuildEvent>copy /y "$(ProjectDir)$(OutDir)ProjectExtenderSetup.msi" "C:\Documents and Settings\avlasova\My Documents\Share"</PostBuildEvent>
</PropertyGroup>
</Project>

0 comments on commit 4b9b67b

Please sign in to comment.