Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4431 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
8 changed files with 298 additions and 23 deletions
@ -0,0 +1,33 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using ICSharpCode.SharpDevelop.Gui; |
||||||
|
using System; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
|
||||||
|
namespace ICSharpCode.SharpDevelop.Editor.Commands |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of CommentRegion
|
||||||
|
/// </summary>
|
||||||
|
public class CommentRegion : AbstractMenuCommand |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Starts the command
|
||||||
|
/// </summary>
|
||||||
|
public override void Run() |
||||||
|
{ |
||||||
|
ITextEditorProvider provider = WorkbenchSingleton.Workbench.ActiveViewContent as ITextEditorProvider; |
||||||
|
|
||||||
|
if (provider == null) |
||||||
|
return; |
||||||
|
|
||||||
|
provider.TextEditor.FormattingStrategy.SurroundSelectionWithComment(provider.TextEditor); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,43 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using ICSharpCode.SharpDevelop.Gui; |
||||||
|
using System; |
||||||
|
using System.Windows.Forms; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
using ICSharpCode.SharpDevelop.Editor; |
||||||
|
|
||||||
|
namespace ICSharpCode.SharpDevelop.Editor.Commands |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of IndentSelection
|
||||||
|
/// </summary>
|
||||||
|
public class IndentSelection : AbstractMenuCommand |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Starts the command
|
||||||
|
/// </summary>
|
||||||
|
public override void Run() |
||||||
|
{ |
||||||
|
ITextEditorProvider provider = WorkbenchSingleton.Workbench.ActiveViewContent as ITextEditorProvider; |
||||||
|
|
||||||
|
if (provider == null) |
||||||
|
return; |
||||||
|
|
||||||
|
int beginLine = 1; |
||||||
|
int endLine = provider.TextEditor.Document.TotalNumberOfLines; |
||||||
|
|
||||||
|
if (provider.TextEditor.SelectionLength != 0) { |
||||||
|
beginLine = provider.TextEditor.Document.GetLineForOffset(provider.TextEditor.SelectionStart).LineNumber; |
||||||
|
endLine = provider.TextEditor.Document.GetLineForOffset(provider.TextEditor.SelectionStart + provider.TextEditor.SelectionLength).LineNumber; |
||||||
|
} |
||||||
|
|
||||||
|
provider.TextEditor.FormattingStrategy.IndentLines(provider.TextEditor, beginLine, endLine); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue