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.
134 lines
4.1 KiB
134 lines
4.1 KiB
<?xml version="1.0"?> |
|
<Template originator = "Markus Palme" |
|
created = "23/01/2006" |
|
lastModified = "23/01/2006"> |
|
|
|
<!-- Template Header --> |
|
<TemplateConfiguration> |
|
<Name>${res:Templates.Project.SharpDevelopMacro.Name}</Name> |
|
<Category>SharpDevelop</Category> |
|
<Icon>VBNet.Project.ControlLibrary</Icon> |
|
<LanguageName>VBNet</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" /> |
|
<Import Include="System" /> |
|
<Import Include="System.Text" /> |
|
<Import Include="System.Collections" /> |
|
<Import Include="System.Windows.Forms" /> |
|
</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.vb"> |
|
<![CDATA[${StandardHeader.VBNET} |
|
|
|
Imports ICSharpCode.Core |
|
Imports ICSharpCode.SharpDevelop |
|
Imports ICSharpCode.SharpDevelop.Gui |
|
Imports ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor |
|
Imports ICSharpCode.TextEditor |
|
|
|
Public Class ToolCommand1 |
|
Inherits AbstractMenuCommand |
|
Public Overrides Sub Run() |
|
'' Here an example that shows how to access the current text document: |
|
|
|
Dim tecp As ITextEditorControlProvider = CType(WorkbenchSingleton.Workbench.ActiveContent, ITextEditorControlProvider) |
|
If tecp Is Nothing Then |
|
' active content is not a text editor control |
|
Return |
|
End If |
|
' Get the active text area from the control: |
|
Dim textArea As TextArea = tecp.TextEditorControl.ActiveTextAreaControl.TextArea |
|
If Not textArea.SelectionManager.HasSomethingSelected Then |
|
Return |
|
End If |
|
' get the selected text: |
|
Dim text As String = textArea.SelectionManager.SelectedText |
|
' reverse the text: |
|
Dim b As StringBuilder = new StringBuilder(text.Length) |
|
For i As Integer = text.Length - 1 To 0 |
|
b.Append(text(i)) |
|
Next |
|
Dim newText As String = 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() |
|
End Sub |
|
End Class |
|
]]></File> |
|
<File name="Configuration/AssemblyInfo.vb"> |
|
<![CDATA[${StandardHeader.VBNET} |
|
|
|
Imports System.Reflection |
|
Imports System.Runtime.CompilerServices |
|
|
|
'Information about this assembly is defined by the following |
|
'attributes. |
|
' |
|
'change them to the information which is associated with the assembly |
|
'you compile. |
|
|
|
<assembly: AssemblyTitle("${ProjectName}")> |
|
<assembly: AssemblyDescription("Addin for SharpDevelop 2.0")> |
|
<assembly: AssemblyConfiguration("")> |
|
<assembly: AssemblyCompany("")> |
|
<assembly: AssemblyProduct("SharpDevelop")> |
|
<assembly: AssemblyCopyright("")> |
|
<assembly: AssemblyTrademark("")> |
|
<assembly: AssemblyCulture("")> |
|
|
|
'The assembly version has following format : |
|
' |
|
'Major.Minor.Build.Revision |
|
' |
|
'You can specify all values by your own or you can build default build and revision |
|
'numbers with the '*' character (the default): |
|
|
|
<assembly: AssemblyVersion("1.0.*")> |
|
]]></File> |
|
</Files> |
|
</Project> |
|
</Combine> |
|
</Template>
|
|
|