VS2005 Collapse All Macro

by Garrett 9. July 2010 17:14

I've used this macro for years on each machine I've used for development, so I thought it would be prudent to pass it along to anyone who stumbles upon my site.

Original location of this macro:  http://www.imiscommunity.com/visual_studio_2005_tips_and_tricks


Here is a macro to collapse all projects in a solution and expand the selected project:

  1. Select ALT+F8 on your VS2005 IDE to open the macro explorer
  2. Right Click MyMacros.
  3. Select New module.
  4. Type the new module name as CollapseAll
  5. Select OK – A new module CollapseAll is created.
  6. Right Click CollapseAll Module
  7. Select Edit – The Macro IDE is launched.
  8. Copy the following Sub and paste it between the module and End module. -- in the Macro IDE (you may need to adjust some lines in order to successfully compile the macro):

    Sub CollapseAll()
    'NavigateSolution()
    ' Get the the Solution Explorer tree
    Dim UIHSolutionExplorer As UIHierarchy
    UIHSolutionExplorer = DTE.Windows.Item(Constants.vsext_wk_SProjectWindow).Object()
    ' Check if there is any open solution
    If (UIHSolutionExplorer.UIHierarchyItems.Count = 0)
    Then
    Return
    End If

    ' Get the top node (the name of the solution)
    Dim UIHSolutionRootNode As UIHierarchyItem
    Dim UIHChildItem As UIHierarchyItem
    UIHSolutionRootNode = UIHSolutionExplorer.UIHierarchyItems.Item(1)

    ' Collapse each project node
    Dim UIHItem As UIHierarchyItem
    For Each UIHItem In UIHSolutionRootNode.UIHierarchyItems
    For Each UIHChildItem In UIHItem.UIHierarchyItems
    UIHChildItem.UIHierarchyItems.Expanded = False
    Next
    UIHItem.UIHierarchyItems.Expanded = False
    Next
    UIHSolutionRootNode.UIHierarchyItems.Expanded = True

    Dim UIHSelectedItem As UIHierarchyItem = UIHSolutionExplorer.SelectedItems(0)
    UIHSelectedItem.UIHierarchyItems.Expanded = True
    End Sub

    Save the module.
    Now add this macro to the toolbar for easy access.

  9. Select Tools -> Customize from the main menu
  10. Select the Command tab in the Customize dialog
  11. Select Macros
  12. Select the CollapseAll macro and drag and drop it on one of VS2005 IDE toolbars. You will see the Macro Name on the ToolBar –
  13. Do not Close the Customize Popup window --
  14. Right Click the Macro Name on the ToolBar
  15. Select Default Style – This will remove the Macro Name on the ToolBar, resulting in a small Rectangle on the ToolBar
  16. Right Click the Small Rectangle
  17. Select ChangeButtonImage
  18. Select one of the images, for example, the HourGlass. You will see the Image on the toolbar.
  19. Close the Customize PopUp
  20. To test the macro:
    1. Select one of the projects in your solution
    2. Select the CollapseAll Button on the ToolBar
    3. Observe the Solution Explorer will collapse all and will expand the project you have selected.

and that's it. Enjoy!

Del.icio.usDigg It!StumbleUpon

Tags:

Caprica

by Garrett 28. February 2010 09:59

Caprica is the latest installment in the Battlestar Galactica series (which originally aired in the late 70s, and which I used to watch as a young boy with my father), and is, in my opinion, one of the best new shows to hit the cable in years. 

I've been a science fiction fan for decades now (scary how fast time flies) growing up with the original Doctor Who, Battlestar Galactica, and Buck Rogers in the 25th Century shows, and I can honestly say that the new Caprica series is simply awesome.  If you watched the premier episode and weren't too impressed, I say give it another chance.  I too was a bit confused for about the first half of the first show.  I sat there for around an hour wondering what the heck I was getting myself involved in.  Thinking to myself, "this isn't science fiction", but then it started to click.  I began making the connections with the new and the old.  And now, after watching the fifth episode, "There is Another Sky", I am eagerly awaiting next week's episode to see what surprises will be revealed next.

Simply Awesome.

- Garrett

 

Del.icio.usDigg It!StumbleUpon

Tags:

BlogEngine.NET

by Garrett 23. February 2010 07:01

As you can see by the footer, this blog is powered by BlogEngine.NET.  Why BlogEngine.NET and not a free blog host like blogspot.com or wordpress.com?  Well, I'm an application developer so naturally I like to get my hands dirty with code whenever possible. 

BlogEngine.NET is generally highly recommended by those who have used it, and I offer the same recommendation.  I assure you that any engine such as this is not for the uninitiated in programming, but I am quite certain that a web-programmer with experience in any language would be able to implement and customize BlogEngine.NET in a reasonable amount of time.  In fact, I just finished helping my 11-year-old son (he's a beginning programmer & he did most of the work himself) add a blog to his website.

Tip of the week:

If you receive a javascript error indicating that 'BlogEngine' is undefined:

Delete the first "comment" line from blog.js [// global object] and all should be fine.

 Garrett

 

Del.icio.usDigg It!StumbleUpon

Tags:

Welcome to BZB Consulting

by Garrett 22. February 2010 02:29

Welcome to my new blog.  I am a professional developer by trade, and I truly enjoy helping people, so please check back often for (hopefully) helpful hints and tips & tricks.

Garrett

Del.icio.usDigg It!StumbleUpon

Tags:

Powered by BlogEngine.NET 1.5.0.7
Theme by BZB Consulting