@@ -20,6 +20,8 @@ private static class SnippetTreeViewMenuContent
20
20
public static readonly GUIContent Top = new GUIContent ( "Top" ) ;
21
21
public static readonly GUIContent UnTop = new GUIContent ( "Un-top" ) ;
22
22
public static readonly GUIContent Delete = new GUIContent ( "Delete" ) ;
23
+ public static readonly GUIContent CreateNewSnippet = new GUIContent ( "Create New Snippet" ) ;
24
+ public static readonly GUIContent CreateNewSnippetUnderCategory = new GUIContent ( "Create New Snippet Under Category" ) ;
23
25
public static readonly GUIContent CreateNewCategory = new GUIContent ( "Create New Category" ) ;
24
26
public static readonly GUIContent CollapseAllCategories = new GUIContent ( "Collapse All" ) ;
25
27
public static readonly GUIContent ExpandAllCategories = new GUIContent ( "Expand All" ) ;
@@ -33,6 +35,7 @@ private static class SnippetTreeViewMenuContent
33
35
/// <param name="menu"></param>
34
36
private void BuildSnippetTreeViewMenu ( GenericMenu menu )
35
37
{
38
+ menu . AddItem ( SnippetTreeViewMenuContent . CreateNewSnippet , false , SnippetTreeViewMenu_CreateNewSnippet ) ;
36
39
menu . AddItem ( SnippetTreeViewMenuContent . CreateNewCategory , false , SnippetTreeViewMenu_CreateNewCategory ) ;
37
40
38
41
menu . AddSeparator ( string . Empty ) ;
@@ -95,6 +98,7 @@ private void BuildSnippetTreeViewItemMenuSnippet(GenericMenu menu, int itemID)
95
98
}
96
99
97
100
menu . AddSeparator ( string . Empty ) ;
101
+ menu . AddItem ( SnippetTreeViewMenuContent . CreateNewSnippetUnderCategory , false , SnippetTreeViewMenu_CreateNewSnippetUnderCategory , itemID ) ;
98
102
menu . AddItem ( SnippetTreeViewMenuContent . CreateNewCategory , false , SnippetTreeViewMenu_CreateNewCategory ) ;
99
103
100
104
menu . AddSeparator ( string . Empty ) ;
@@ -111,6 +115,7 @@ private void BuildSnippetTreeViewItemMenuCategory(GenericMenu menu, int itemID)
111
115
else menu . AddItem ( SnippetTreeViewMenuContent . Delete , false , SnippetTreeViewMenu_DeleteCategory , itemID ) ;
112
116
113
117
menu . AddSeparator ( string . Empty ) ;
118
+ menu . AddItem ( SnippetTreeViewMenuContent . CreateNewSnippetUnderCategory , false , SnippetTreeViewMenu_CreateNewSnippetUnderCategory , itemID ) ;
114
119
menu . AddItem ( SnippetTreeViewMenuContent . CreateNewCategory , false , SnippetTreeViewMenu_CreateNewCategory ) ;
115
120
116
121
menu . AddSeparator ( string . Empty ) ;
@@ -202,6 +207,17 @@ private void SnippetTreeViewMenu_PasteFromClipboard()
202
207
DoPasteFromClipboard ( ) ;
203
208
}
204
209
210
+ private void SnippetTreeViewMenu_CreateNewSnippet ( )
211
+ {
212
+ SaveAsNewSnippet ( string . Empty , null , CodeExecutorManager . DefaultExecMode . name , null ) ;
213
+ }
214
+
215
+ private void SnippetTreeViewMenu_CreateNewSnippetUnderCategory ( object itemID )
216
+ {
217
+ string category = GetSnippetCategoryBySnippetTreeViewItemId ( ( int ) itemID ) ;
218
+ SaveAsNewSnippet ( string . Empty , null , CodeExecutorManager . DefaultExecMode . name , category ) ;
219
+ }
220
+
205
221
private void SnippetTreeViewMenu_CreateNewCategory ( )
206
222
{
207
223
CreateNewCategory ( ) ;
0 commit comments