{"id":7208,"date":"2014-05-01T06:58:00","date_gmt":"2014-05-01T14:58:00","guid":{"rendered":"http:\/\/www.sapien.com\/blog\/?p=7208"},"modified":"2014-05-01T07:02:04","modified_gmt":"2014-05-01T15:02:04","slug":"powershell-studio-2014-rename-refactoring","status":"publish","type":"post","link":"https:\/\/dev.sapien.com\/blog\/2014\/05\/01\/powershell-studio-2014-rename-refactoring\/","title":{"rendered":"PowerShell Studio 2014: Rename Refactoring"},"content":{"rendered":"<p>Another new feature of PowerShell Studio 2014 is rename refactoring. Rename refactoring allows you to intelligently rename variables, controls, parameters, functions and more.<\/p>\n<p>You start by right-clicking on the object you wish to rename to bring up the context menu. Then select <em>Rename\u2026<\/em> from the menu:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"image\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/04\/image5.png\" alt=\"image\" width=\"441\" height=\"243\" border=\"0\" \/><\/p>\n<p>You are then presented with the rename dialog:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"image\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/04\/image6.png\" alt=\"image\" width=\"455\" height=\"229\" border=\"0\" \/><\/p>\n<p>Let us cover each field:<\/p>\n<p><em><strong>New Name:<\/strong><\/em><\/p>\n<p>Here you enter the new name for the selected object.<\/p>\n<p><em><strong>Object Type:<\/strong><\/em><\/p>\n<p>This field lets you know what type of object you are renaming.<\/p>\n<p>The field will display the following types:<\/p>\n<table border=\"0\" width=\"595\" cellspacing=\"0\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"128\"><strong>Object Type<\/strong><\/td>\n<td valign=\"top\" width=\"465\"><strong>Description<\/strong><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"132\"><em>Event <\/em><\/td>\n<td valign=\"top\" width=\"465\">Updates the event variable and references in the designer.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"139\"><em>Function<\/em><\/td>\n<td valign=\"top\" width=\"465\">Updates function declaration and function calls.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"144\"><em>GUI Control<\/em><\/td>\n<td valign=\"top\" width=\"465\">Updates the GUI control variables and updates any event names and return variables for projects<em>.<\/em><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"142\"><em>Parameter<\/em><\/td>\n<td valign=\"top\" width=\"465\">Updates the parameter for the function and any calls using the parameter.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"136\"><em>Variable<\/em><\/td>\n<td valign=\"top\" width=\"465\">Updates variables within the document that aren\u2019t a parameter or GUI control.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Note: Depending on the object\u2019s type the some settings may vary.<\/p>\n<p>&nbsp;<\/p>\n<p><em><strong>Scope:<\/strong><\/em><\/p>\n<p>The scope lets you define in which scope the objects will be replaced.<\/p>\n<p>Depending on the object type the following scopes may be selected:<\/p>\n<table border=\"0\" width=\"599\" cellspacing=\"0\" cellpadding=\"2\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"119\"><strong>Scope<\/strong><\/td>\n<td valign=\"top\" width=\"478\"><strong>Description<\/strong><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"126\">Current Scope<\/td>\n<td valign=\"top\" width=\"478\">Rename refactoring only occurs within the scope of the current function or event block.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"130\">Current Document<\/td>\n<td valign=\"top\" width=\"478\">Rename refactoring will occur for all instances of the object within the current document.<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"134\">Entire Project<\/td>\n<td valign=\"top\" width=\"478\">Rename refactoring will occur for all instances of the object within all the project files.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>GUI Controls, Events, Parameters and Functions will always apply to the global scope such as the Current Document or the Entire Project.<\/p>\n<p><em><strong>Preview references changes:<\/strong><\/em><\/p>\n<p>When this option is checked, you will be presented with a dialog listing all the changes that will take affect.<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/04\/image7.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"image\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/04\/image_thumb3.png\" alt=\"image\" width=\"244\" height=\"193\" border=\"0\" \/><\/a><\/p>\n<p>Here you can preview the changes by clicking on any item in the list.<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/04\/image8.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"image\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/04\/image_thumb4.png\" alt=\"image\" width=\"244\" height=\"137\" border=\"0\" \/><\/a><\/p>\n<p>You can also uncheck an item if you do not want that particular instance to be modified.<\/p>\n<p>Note: You are unable to uncheck items if you are renaming a GUI Control.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Rename Refactoring in Projects<\/strong><\/p>\n<p>Rename refactoring can be extremely useful when dealing with multiple files as in a project, because it will update all the project files (with the exception of excluded files):<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/04\/image9.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; border-width: 0px;\" title=\"image\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/04\/image_thumb5.png\" alt=\"image\" width=\"244\" height=\"124\" border=\"0\" \/><\/a><\/p>\n<p>In PowerShell Studio 2014 return variables are updated when a GUI control is renamed. In addition, when you rename a project file in PowerShell Studio 2014, all the reference functions and return variables are updated to reflect the new file name.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"margin: 10px 3px 0px 0px; display: inline; border-width: 0px;\" title=\"Tip\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2014\/04\/Tip.png\" alt=\"Tip\" width=\"32\" height=\"32\" align=\"left\" border=\"0\" \/><br \/>\nIf you include ps1 files as content and dot source the file within a project, calls to functions defined in the dot sourced file can be updated using rename refactoring.<\/p>\n<p>&nbsp;<\/p>\n<p>The new rename refactoring feature can be a big time saver when renaming events, variables, functions and other objects. In addition, with the preview you can quickly see where the object is used and selectively decide if you want to go forward with any change.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Another new feature of PowerShell Studio 2014 is rename refactoring. Rename refactoring allows you to intelligently rename variables, controls, parameters, functions and more. You start by right-clicking on the object you wish to rename to bring up the context menu. Then select Rename\u2026 from the menu: You are then presented with the rename dialog: Let [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[703,632,25],"tags":[28,874,908],"class_list":["post-7208","post","type-post","status-publish","format-standard","hentry","category-powershell-studio","category-whats-new-software-news","category-windows-powershell","tag-powershell","tag-powershell-studio-2014","tag-rename-refactoring"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/7208","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/comments?post=7208"}],"version-history":[{"count":6,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/7208\/revisions"}],"predecessor-version":[{"id":7323,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/7208\/revisions\/7323"}],"wp:attachment":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/media?parent=7208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/categories?post=7208"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/tags?post=7208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}