@@ -239,6 +239,7 @@ private void CreateMenuItems()
239
239
{
240
240
this . refactorMainMenu = new RefactorMenu ( true ) ;
241
241
this . refactorMainMenu . RenameMenuItem . Click += this . RenameClicked ;
242
+ refactorMainMenu . MoveMenuItem . Click += MoveClicked ;
242
243
this . refactorMainMenu . OrganizeMenuItem . Click += this . OrganizeImportsClicked ;
243
244
this . refactorMainMenu . TruncateMenuItem . Click += this . TruncateImportsClicked ;
244
245
this . refactorMainMenu . ExtractMethodMenuItem . Click += this . ExtractMethodClicked ;
@@ -248,6 +249,7 @@ private void CreateMenuItems()
248
249
this . refactorMainMenu . BatchMenuItem . Click += this . BatchMenuItemClicked ;
249
250
this . refactorContextMenu = new RefactorMenu ( false ) ;
250
251
this . refactorContextMenu . RenameMenuItem . Click += this . RenameClicked ;
252
+ refactorContextMenu . MoveMenuItem . Click += MoveClicked ;
251
253
this . refactorContextMenu . OrganizeMenuItem . Click += this . OrganizeImportsClicked ;
252
254
this . refactorContextMenu . TruncateMenuItem . Click += this . TruncateImportsClicked ;
253
255
this . refactorContextMenu . DelegateMenuItem . Click += this . DelegateMethodsClicked ;
@@ -277,6 +279,7 @@ private void CreateMenuItems()
277
279
private void RegisterMenuItems ( )
278
280
{
279
281
PluginBase . MainForm . RegisterShortcutItem ( "RefactorMenu.Rename" , this . refactorMainMenu . RenameMenuItem ) ;
282
+ PluginBase . MainForm . RegisterShortcutItem ( "RefactorMenu.Move" , refactorMainMenu . MoveMenuItem ) ;
280
283
PluginBase . MainForm . RegisterShortcutItem ( "RefactorMenu.ExtractMethod" , this . refactorMainMenu . ExtractMethodMenuItem ) ;
281
284
PluginBase . MainForm . RegisterShortcutItem ( "RefactorMenu.ExtractLocalVariable" , this . refactorMainMenu . ExtractLocalVariableMenuItem ) ;
282
285
PluginBase . MainForm . RegisterShortcutItem ( "RefactorMenu.GenerateDelegateMethods" , this . refactorMainMenu . DelegateMenuItem ) ;
@@ -285,6 +288,7 @@ private void RegisterMenuItems()
285
288
PluginBase . MainForm . RegisterShortcutItem ( "RefactorMenu.CodeGenerator" , this . refactorMainMenu . CodeGeneratorMenuItem ) ;
286
289
PluginBase . MainForm . RegisterShortcutItem ( "RefactorMenu.BatchProcess" , this . refactorMainMenu . BatchMenuItem ) ;
287
290
PluginBase . MainForm . RegisterSecondaryItem ( "RefactorMenu.Rename" , this . refactorContextMenu . RenameMenuItem ) ;
291
+ PluginBase . MainForm . RegisterSecondaryItem ( "RefactorMenu.Move" , refactorContextMenu . MoveMenuItem ) ;
288
292
PluginBase . MainForm . RegisterSecondaryItem ( "RefactorMenu.ExtractMethod" , this . refactorContextMenu . ExtractMethodMenuItem ) ;
289
293
PluginBase . MainForm . RegisterSecondaryItem ( "RefactorMenu.ExtractLocalVariable" , this . refactorContextMenu . ExtractLocalVariableMenuItem ) ;
290
294
PluginBase . MainForm . RegisterSecondaryItem ( "RefactorMenu.GenerateDelegateMethods" , this . refactorContextMenu . DelegateMenuItem ) ;
@@ -353,25 +357,33 @@ private void UpdateMenuItems()
353
357
this . refactorMainMenu . OrganizeMenuItem . Enabled = organize ;
354
358
this . refactorMainMenu . TruncateMenuItem . Enabled = truncate ;
355
359
}
360
+ refactorMainMenu . MoveMenuItem . Enabled = false ;
361
+ refactorContextMenu . MoveMenuItem . Enabled = false ;
356
362
this . surroundContextMenu . Enabled = false ;
357
363
this . refactorMainMenu . SurroundMenu . Enabled = false ;
358
364
this . refactorContextMenu . ExtractMethodMenuItem . Enabled = false ;
359
365
this . refactorContextMenu . ExtractLocalVariableMenuItem . Enabled = false ;
360
366
this . refactorMainMenu . ExtractMethodMenuItem . Enabled = false ;
361
367
this . refactorMainMenu . ExtractLocalVariableMenuItem . Enabled = false ;
362
368
ITabbedDocument document = PluginBase . MainForm . CurrentDocument ;
363
- if ( document != null && document . IsEditable && langIsValid && document . SciControl . SelTextSize > 1 )
369
+ if ( document != null && document . IsEditable && langIsValid )
364
370
{
365
- Int32 selEnd = document . SciControl . SelectionEnd ;
366
- Int32 selStart = document . SciControl . SelectionStart ;
367
- if ( ! document . SciControl . PositionIsOnComment ( selEnd ) || ! document . SciControl . PositionIsOnComment ( selStart ) )
371
+ bool isValidFile = IsValidFile ( document . FileName ) ;
372
+ refactorMainMenu . MoveMenuItem . Enabled = isValidFile ;
373
+ refactorContextMenu . MoveMenuItem . Enabled = isValidFile ;
374
+ if ( document . SciControl . SelTextSize > 1 )
368
375
{
369
- this . surroundContextMenu . Enabled = true ;
370
- this . refactorMainMenu . SurroundMenu . Enabled = true ;
371
- this . refactorContextMenu . ExtractMethodMenuItem . Enabled = true ;
372
- this . refactorMainMenu . ExtractMethodMenuItem . Enabled = true ;
373
- this . refactorContextMenu . ExtractLocalVariableMenuItem . Enabled = true ;
374
- this . refactorMainMenu . ExtractLocalVariableMenuItem . Enabled = true ;
376
+ Int32 selEnd = document . SciControl . SelectionEnd ;
377
+ Int32 selStart = document . SciControl . SelectionStart ;
378
+ if ( ! document . SciControl . PositionIsOnComment ( selEnd ) || ! document . SciControl . PositionIsOnComment ( selStart ) )
379
+ {
380
+ this . surroundContextMenu . Enabled = true ;
381
+ this . refactorMainMenu . SurroundMenu . Enabled = true ;
382
+ this . refactorContextMenu . ExtractMethodMenuItem . Enabled = true ;
383
+ this . refactorMainMenu . ExtractMethodMenuItem . Enabled = true ;
384
+ this . refactorContextMenu . ExtractLocalVariableMenuItem . Enabled = true ;
385
+ this . refactorMainMenu . ExtractLocalVariableMenuItem . Enabled = true ;
386
+ }
375
387
}
376
388
}
377
389
this . refactorContextMenu . CodeGeneratorMenuItem . Enabled = isValid ;
@@ -428,6 +440,14 @@ private void RenameClicked(Object sender, EventArgs e)
428
440
}
429
441
}
430
442
443
+ /// <summary>
444
+ /// Invoked when the user selects the "Move" command
445
+ /// </summary>
446
+ static void MoveClicked ( object sender , EventArgs e )
447
+ {
448
+
449
+ }
450
+
431
451
/// <summary>
432
452
///
433
453
/// </summary>
0 commit comments