#develop (short for SharpDevelop) is a free IDE for .NET programming languages.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

107 lines
3.3 KiB

<?xml version="1.0"?>
<Template originator = "Daniel Grunwald"
created = "01/11/2005"
lastModified = "01/11/2005">
<!-- Template Header -->
<TemplateConfiguration>
<Name>${res:Templates.Project.SharpDevelopMacro.Name}</Name>
<Category>SharpDevelop</Category>
<Icon>C#.Project.ControlLibrary</Icon>
<LanguageName>C#</LanguageName>
<Description>${res:Templates.Project.SharpDevelopMacro.Description}</Description>
</TemplateConfiguration>
<!-- Actions -->
<Actions>
<Open filename = "${ProjectName}.addin"/>
</Actions>
<Combine name = "${ProjectName}" directory = ".">
<Options>
<StartupProject>${ProjectName}</StartupProject>
</Options>
<Project name = "${ProjectName}" directory = ".">
<Options OutputType = "Library" />
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ProjectItems>
<Files>
<File name="${ProjectName}.addin" copyToOutputDirectory="Always"><![CDATA[<AddIn name = "${ProjectName}"
author = "${USER}"
url = ""
description = "TODO: Put description here">
<Runtime>
<Import assembly = "${ProjectName}.dll"/>
</Runtime>
<Path name = "/Workspace/Tools">
<MenuItem id = "${ProjectName}Command1"
label = "${ProjectName}"
class = "${StandardNamespace}.ToolCommand1"/>
</Path>
</AddIn>
]]></File>
<File name="Src/Command.cs">
<![CDATA[${StandardHeader.C#}
using System;
using System.Text;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.TextEditor;
namespace ${StandardNamespace}
{
public class ToolCommand1 : AbstractMenuCommand
{
public override void Run()
{
// Here an example that shows how to access the current text document:
ITextEditorControlProvider tecp = WorkbenchSingleton.Workbench.ActiveContent as ITextEditorControlProvider;
if (tecp == null) {
// active content is not a text editor control
return;
}
// Get the active text area from the control:
TextArea textArea = tecp.TextEditorControl.ActiveTextAreaControl.TextArea;
if (!textArea.SelectionManager.HasSomethingSelected)
return;
// get the selected text:
string text = textArea.SelectionManager.SelectedText;
// reverse the text:
StringBuilder b = new StringBuilder(text.Length);
for (int i = text.Length - 1; i >= 0; i--)
b.Append(text[i]);
string newText = b.ToString();
// ensure caret is at start of selection
textArea.Caret.Position = textArea.SelectionManager.SelectionCollection[0].StartPosition;
// deselect text
textArea.SelectionManager.ClearSelection();
// replace the selected text with the new text:
// Replace() takes the arguments: start offset to replace, length of the text to remove, new text
textArea.Document.Replace(textArea.Caret.Offset,
text.Length,
newText);
// Redraw:
textArea.Refresh();
}
}
}
]]></File>
<File name="Configuration/AssemblyInfo.cs" src="DefaultAssemblyInfo.cs"/>
</Files>
</Project>
</Combine>
</Template>