Skip to content

Commit

Permalink
Merge pull request #3 from akb825/master
Browse files Browse the repository at this point in the history
Improve display of items.
  • Loading branch information
parnic authored Mar 31, 2018
2 parents 9e559b0 + eeb4014 commit fef7841
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 52 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ bld/
# Roslyn cache directories
*.ide/

# Visual Studio 2017 cache directories
.vs/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
Expand Down Expand Up @@ -125,7 +128,7 @@ publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
Expand Down
72 changes: 60 additions & 12 deletions ListFiles.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,40 @@
Closing="Window_Closing">

<Window.Resources>
<Style TargetType="ListBox">
<Style TargetType="DataGrid">
<Setter Property="Foreground" Value="{DynamicResource {x:Static vs_shell:EnvironmentColors.ToolWindowTextBrushKey}}"/>
<Setter Property="Background" Value="{DynamicResource {x:Static vs_shell:EnvironmentColors.ToolWindowBackgroundBrushKey}}"/>
</Style>
<Style TargetType="DataGridColumnHeader">
<Setter Property="Foreground" Value="{DynamicResource {x:Static vs_shell:EnvironmentColors.GridHeadingTextBrushKey}}"/>
<Setter Property="Background" Value="{DynamicResource {x:Static vs_shell:EnvironmentColors.GridHeadingBackgroundBrushKey}}"/>
<Setter Property="SeparatorBrush" Value="{DynamicResource {x:Static vs_shell:EnvironmentColors.GridLineBrushKey}}"/>
<Setter Property="Padding" Value="4 0 0 0"/>
</Style>
<Style TargetType="DataGridCell">
<Setter Property="Foreground" Value="{DynamicResource {x:Static vs_shell:EnvironmentColors.ToolWindowTextBrushKey}}"/>
<Setter Property="Background" Value="{DynamicResource {x:Static vs_shell:EnvironmentColors.ToolWindowBackgroundBrushKey}}"/>
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static vs_shell:EnvironmentColors.GridLineBrushKey}}"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Foreground" Value="{DynamicResource {x:Static vs_shell:EnvironmentColors.SystemHighlightTextBrushKey}}"/>
<Setter Property="Background" Value="{DynamicResource {x:Static vs_shell:EnvironmentColors.SystemHighlightBrushKey}}"/>
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="DataGridRowHeader">
<Setter Property="Background" Value="{DynamicResource {x:Static vs_shell:EnvironmentColors.GridHeadingBackgroundBrushKey}}"/>
</Style>
<Style TargetType="DataGridRow">
<Setter Property="Foreground" Value="{DynamicResource {x:Static vs_shell:EnvironmentColors.ToolWindowTextBrushKey}}"/>
<Setter Property="Background" Value="{DynamicResource {x:Static vs_shell:EnvironmentColors.ToolWindowBackgroundBrushKey}}"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Foreground" Value="{DynamicResource {x:Static vs_shell:EnvironmentColors.SystemHighlightTextBrushKey}}"/>
<Setter Property="Background" Value="{DynamicResource {x:Static vs_shell:EnvironmentColors.SystemHighlightBrushKey}}"/>
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="{DynamicResource {x:Static vs_shell:EnvironmentColors.ToolWindowTextBrushKey}}"/>
<Setter Property="Background" Value="{DynamicResource {x:Static vs_shell:EnvironmentColors.ToolWindowBackgroundBrushKey}}"/>
Expand All @@ -33,10 +63,10 @@
<ControlTemplate TargetType="{x:Type CheckBox}">
<BulletDecorator Background="Transparent">
<BulletDecorator.Bullet>
<Border x:Name="Border"
Width="13"
Height="13"
CornerRadius="0"
<Border x:Name="Border"
Width="13"
Height="13"
CornerRadius="0"
Background="{DynamicResource {x:Static vs_shell:EnvironmentColors.ToolWindowBackgroundBrushKey}}"
BorderThickness="1"
BorderBrush="#404040">
Expand Down Expand Up @@ -87,13 +117,31 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ListBox Name="lstFiles" SelectionMode="Extended" MouseDoubleClick="lstFiles_MouseDoubleClick">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Filename}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<DataGrid Name="lstFiles" SelectionMode="Extended" MouseDoubleClick="lstFiles_MouseDoubleClick" PreviewKeyDown="lstFiles_PreviewKeyDown" AutoGenerateColumns="False" CanUserResizeRows="False" CanUserDeleteRows="False">
<DataGrid.Columns>
<DataGridTemplateColumn Header="Name" Width="SizeToCells">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Filename}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Project" Width="Auto">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Project}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Path" Width="Auto">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
Expand Down
13 changes: 11 additions & 2 deletions ListFiles.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ private void OpenSelectedFiles(bool bInSolutionExplorer)

private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
SaveWindowSettings();
SaveWindowSettings();
}

private void txtFilter_KeyDown(object sender, KeyEventArgs e)
{
if (lstFiles.Items.Count > 0)
Expand Down Expand Up @@ -220,6 +220,15 @@ private void lstFiles_MouseDoubleClick(object sender, MouseButtonEventArgs e)
}
}

private void lstFiles_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter || e.Key == Key.Return)
{
e.Handled = true;
OpenSelectedFiles(Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl));
}
}

private void btnSettings_Click(object sender, RoutedEventArgs e)
{
if (grdSettings.Visibility == Visibility.Collapsed)
Expand Down
5 changes: 4 additions & 1 deletion OpenFileInSolution.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>12.0</OldToolsVersion>
<StartAction>Program</StartAction>
<StartProgram>$(DevEnvDir)\devenv.exe</StartProgram>
<StartArguments>/rootsuffix Exp</StartArguments>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
Expand Down Expand Up @@ -202,7 +205,7 @@
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
Expand Down
18 changes: 11 additions & 7 deletions OpenFileInSolutionPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ namespace PerniciousGames.OpenFileInSolution
public class ProjectItemWrapper : IEquatable<ProjectItemWrapper>
{
public string Filename { get; set; }
public string Project { get; set; }
public string Path { get; set; }
public ProjectItem ProjItem;

private ProjectItemWrapper()
Expand All @@ -23,12 +25,14 @@ private ProjectItemWrapper()
public ProjectItemWrapper(ProjectItem inItem)
{
ProjItem = inItem;
Filename = inItem.FileNames[1];
Path = inItem.FileNames[1];
Filename = System.IO.Path.GetFileName(Path);
Project = ProjItem.ContainingProject.Name;
}

public bool Equals(ProjectItemWrapper other)
{
return Filename == other.Filename;
return Path == other.Path;
}
}

Expand All @@ -51,8 +55,8 @@ public int GetHashCode(ProjectItemWrapper obj)
/// The minimum requirement for a class to be considered a valid package for Visual Studio
/// is to implement the IVsPackage interface and register itself with the shell.
/// This package uses the helper classes defined inside the Managed Package Framework (MPF)
/// to do it: it derives from the Package class that provides the implementation of the
/// IVsPackage interface and uses the registration attributes defined in the framework to
/// to do it: it derives from the Package class that provides the implementation of the
/// IVsPackage interface and uses the registration attributes defined in the framework to
/// register itself and its components with the shell.
/// </summary>
// This attribute tells the PkgDef creation utility (CreatePkgDef.exe) that this class is
Expand Down Expand Up @@ -81,9 +85,9 @@ public abstract class EnvDTEProjectKinds

/// <summary>
/// Default constructor of the package.
/// Inside this method you can place any initialization code that does not require
/// any Visual Studio service because at this point the package object is created but
/// not sited yet inside Visual Studio environment. The place to do all the other
/// Inside this method you can place any initialization code that does not require
/// any Visual Studio service because at this point the package object is created but
/// not sited yet inside Visual Studio environment. The place to do all the other
/// initialization is the Initialize method.
/// </summary>
public OpenFileInSolutionPackage()
Expand Down
14 changes: 7 additions & 7 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenFileInSolution")]
Expand All @@ -14,23 +14,23 @@
[assembly: AssemblyProduct("OpenFileInSolution")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]
[assembly: NeutralResourcesLanguage("en-US")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:

[assembly: AssemblyVersion("1.12.0.0")]
[assembly: AssemblyFileVersion("1.12.0.0")]
[assembly: AssemblyVersion("1.13.0.0")]
[assembly: AssemblyFileVersion("1.13.0.0")]



Binary file modified openfileinsolution.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 22 additions & 22 deletions source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="6bb18fff-9e74-4deb-97df-6a94ddafb74e" Version="1.12" Language="en-US" Publisher="Pernicious Games" />
<DisplayName>OpenFileInSolution</DisplayName>
<Description>Shows a list of all files in the current solution and allows quickly filtering and opening them.</Description>
<License>LICENSE</License>
<PreviewImage>openfileinsolution.png</PreviewImage>
<Tags>open file, quick find</Tags>
</Metadata>
<Installation InstalledByMsi="false">
<InstallationTarget Id="Microsoft.VisualStudio.IntegratedShell" Version="[11.0, 15.0]" />
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
<Dependency d:Source="Installed" Version="[11.0,13.0)" Id="Microsoft.VisualStudio.MPF" DisplayName="Visual Studio MPF" />
</Dependencies>
<Assets>
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />
</Assets>
<Prerequisites>
<Prerequisite Id="Microsoft.VisualStudio.ComponentGroup.VisualStudioExtension.Prerequisites" Version="[15.0.26208.0,16.0)" DisplayName="Visual Studio extension development prerequisites" />
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0.26208.0,16.0)" DisplayName="Visual Studio core editor" />
</Prerequisites>
<Metadata>
<Identity Id="6bb18fff-9e74-4deb-97df-6a94ddafb74e" Version="1.13" Language="en-US" Publisher="Pernicious Games" />
<DisplayName>OpenFileInSolution</DisplayName>
<Description xml:space="preserve">Shows a list of all files in the current solution and allows quickly filtering and opening them.</Description>
<License>LICENSE</License>
<PreviewImage>openfileinsolution.png</PreviewImage>
<Tags>open file, quick find</Tags>
</Metadata>
<Installation InstalledByMsi="false">
<InstallationTarget Id="Microsoft.VisualStudio.IntegratedShell" Version="[11.0, 15.0]" />
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
<Dependency d:Source="Installed" Version="[11.0,13.0)" Id="Microsoft.VisualStudio.MPF" DisplayName="Visual Studio MPF" />
</Dependencies>
<Assets>
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />
</Assets>
<Prerequisites>
<Prerequisite Id="Microsoft.VisualStudio.ComponentGroup.VisualStudioExtension.Prerequisites" Version="[15.0.26208.0,16.0)" DisplayName="Visual Studio extension development prerequisites" />
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0.26208.0,16.0)" DisplayName="Visual Studio core editor" />
</Prerequisites>
</PackageManifest>

0 comments on commit fef7841

Please sign in to comment.