Browse Source
Added "StringResourceToolAddIn" to src/Tools: little AddIn that helps adding resources to our internal translation database. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1009 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
15 changed files with 533 additions and 281 deletions
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,27 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Daniel Grunwald |
||||||
|
* Date: 19.01.2006 |
||||||
|
* Time: 16:34 |
||||||
|
*/ |
||||||
|
|
||||||
|
using System.Reflection; |
||||||
|
|
||||||
|
[assembly: AssemblyTitle("StringResourceToolAddIn")] |
||||||
|
[assembly: AssemblyDescription("Macro 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.*")] |
||||||
|
|
@ -0,0 +1,69 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Daniel Grunwald |
||||||
|
* Date: 19.01.2006 |
||||||
|
* Time: 16:34 |
||||||
|
*/ |
||||||
|
|
||||||
|
using System; |
||||||
|
using System.IO; |
||||||
|
using System.Diagnostics; |
||||||
|
using System.Text; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
using ICSharpCode.SharpDevelop.Gui; |
||||||
|
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; |
||||||
|
using ICSharpCode.TextEditor; |
||||||
|
|
||||||
|
namespace StringResourceToolAddIn |
||||||
|
{ |
||||||
|
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; |
||||||
|
|
||||||
|
string resourceName = MessageService.ShowInputBox("Add Resource", "Enter the resource name", PropertyService.Get("ResourceToolLastResourceName")); |
||||||
|
if (resourceName == null || resourceName.Length == 0) return; |
||||||
|
PropertyService.Set("ResourceToolLastResourceName", resourceName); |
||||||
|
|
||||||
|
string purpose = MessageService.ShowInputBox("Add Resource", "Enter resource purpose (may be empty)", ""); |
||||||
|
if (purpose == null) return; |
||||||
|
|
||||||
|
string newText = "${res:" + resourceName + "}"; |
||||||
|
|
||||||
|
// 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(); |
||||||
|
|
||||||
|
string path = Path.Combine(FileUtility.ApplicationRootPath, "src/Tools/StringResourceTool/bin/Debug"); |
||||||
|
ProcessStartInfo info = new ProcessStartInfo(path + "/StringResourceTool.exe", |
||||||
|
"\"" + resourceName + "\" " |
||||||
|
+ "\"" + text + "\" " |
||||||
|
+ "\"" + purpose + "\""); |
||||||
|
info.WorkingDirectory = path; |
||||||
|
Process.Start(info); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,20 @@ |
|||||||
|
<AddIn name = "StringResourceToolAddIn" |
||||||
|
author = "Daniel Grunwald" |
||||||
|
url = "" |
||||||
|
description = "TODO: Put description here"> |
||||||
|
|
||||||
|
<Manifest> |
||||||
|
<Identity name="ICSharpCode.Internal.StringResourceToolAddIn" version="@StringResourceToolAddIn.dll"/> |
||||||
|
</Manifest> |
||||||
|
|
||||||
|
<Runtime> |
||||||
|
<Import assembly = "StringResourceToolAddIn.dll"/> |
||||||
|
</Runtime> |
||||||
|
|
||||||
|
<Path name = "/Workspace/Tools"> |
||||||
|
<MenuItem id = "StringResourceToolAddInCommand1" |
||||||
|
label = "StringResourceToolAddIn" |
||||||
|
shortcut = "Control|Shift|R" |
||||||
|
class = "StringResourceToolAddIn.ToolCommand1"/> |
||||||
|
</Path> |
||||||
|
</AddIn> |
@ -0,0 +1,64 @@ |
|||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
<PropertyGroup> |
||||||
|
<OutputType>Library</OutputType> |
||||||
|
<RootNamespace>StringResourceToolAddIn</RootNamespace> |
||||||
|
<AssemblyName>StringResourceToolAddIn</AssemblyName> |
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||||
|
<ProjectGuid>{3648E209-B853-4168-BFB5-7A60EAF316F8}</ProjectGuid> |
||||||
|
<OutputPath>..\..\..\AddIns\</OutputPath> |
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||||
|
<NoStdLib>False</NoStdLib> |
||||||
|
<RegisterForComInterop>False</RegisterForComInterop> |
||||||
|
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||||
|
<BaseAddress>4194304</BaseAddress> |
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget> |
||||||
|
<FileAlignment>4096</FileAlignment> |
||||||
|
<WarningLevel>4</WarningLevel> |
||||||
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||||
|
<Optimize>False</Optimize> |
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||||
|
<DebugSymbols>true</DebugSymbols> |
||||||
|
<DebugType>Full</DebugType> |
||||||
|
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||||
|
<Optimize>True</Optimize> |
||||||
|
<DefineConstants>TRACE</DefineConstants> |
||||||
|
<DebugSymbols>False</DebugSymbols> |
||||||
|
<DebugType>None</DebugType> |
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||||
|
</PropertyGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Reference Include="System" /> |
||||||
|
<Reference Include="System.Data" /> |
||||||
|
<Reference Include="System.Drawing" /> |
||||||
|
<Reference Include="System.Windows.Forms" /> |
||||||
|
<Reference Include="System.Xml" /> |
||||||
|
<Reference Include="ICSharpCode.SharpDevelop"> |
||||||
|
<HintPath>..\..\..\bin\ICSharpCode.SharpDevelop.dll</HintPath> |
||||||
|
<SpecificVersion>False</SpecificVersion> |
||||||
|
<Private>False</Private> |
||||||
|
</Reference> |
||||||
|
<Reference Include="ICSharpCode.Core"> |
||||||
|
<HintPath>..\..\..\bin\ICSharpCode.Core.dll</HintPath> |
||||||
|
<SpecificVersion>False</SpecificVersion> |
||||||
|
<Private>False</Private> |
||||||
|
</Reference> |
||||||
|
<Reference Include="ICSharpCode.TextEditor"> |
||||||
|
<HintPath>..\..\..\bin\ICSharpCode.TextEditor.dll</HintPath> |
||||||
|
<SpecificVersion>False</SpecificVersion> |
||||||
|
<Private>False</Private> |
||||||
|
</Reference> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<None Include="StringResourceToolAddIn.addin"> |
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||||
|
</None> |
||||||
|
<Compile Include="Src\Command.cs" /> |
||||||
|
<Compile Include="Configuration\AssemblyInfo.cs" /> |
||||||
|
</ItemGroup> |
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||||
|
</Project> |
Loading…
Reference in new issue