SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Christian Hornung

Oktober 2006 - Posts

  • ResourceToolkit addin

    The ResourceToolkit addin has been added to SharpDevelop 2.1 ("Serralongue") in revision 1866.

    It is intended to be used in development of localizable applications and helps the developer with managing string resources by providing tool tips on resource keys and code completion. These features are currently working in most cases when the .NET framework resource accessing classes (System.Resources.ResourceManager or derived classes) are used. String resource access using ICSharpCode.Core ("${res:...}" or ResourceService.GetString) is also supported. The following screenshot shows the resource code completion window:

    Resource code completion window

    The documentation of the previous (discontinued) stand-alone version of this addin is still available on my website:
    http://dev.hornung.dynalias.com/
    There you can find some more detailed information especially on the exact coding requirements for the addin to detect the resource references. 

    If you already had the stand-alone version installed, and are now upgrading to a newer SharpDevelop build, you should uninstall the stand-alone version using the AddIn Manager to avoid problems and duplicate menu items. 

     

    New features

    The integrated version of the addin has some new major features that were not present in any previous version.

    First, "Find references" and "Rename" commands are now available for resource keys:

    Resource refactoring menu 

    They operate on the whole solution and can be used like the similar commands for classes, methods etc.
    "Rename" will rename all occurrences of the resource key in code, the resource key itself in the resource file and also in all localized resource files with the same name, as long as these are in the same directory as the main resource file.

    Two other new commands are available through the tools menu:

     

    These commands also operate on the whole solution. Their performance is quite bad at the moment because they need to resolve all resource references in all source code files, but I have already some ideas how to improve that.

    "Find missing resource keys" looks for resource keys that are referenced in code but cannot be found in the resource file. The results are displayed in the search results panel:

    Here I ran this command on a copy of the SharpDevelop source code (this took about 72 seconds in debug mode, by the way). The one item it has found here is not actually a missing key. The addin has found the string "${res:" as an indication of an ICSharpCode.Core resource reference, but of course it cannot find this key because it is concatenated at runtime with a variable, and so this key is reported as missing.
     

    "Find unused resource keys" looks for keys that are present in a resource file but not referenced anywhere in code. The results are displayed in a new view:

     

    Here I ran this command on the SharpDevelop solution as well.

    Note that you have to be very careful with the list you get here. The addin cannot detect all kinds of resource references, especially not ones that are outside the scope of the open solution. So this list most probably always shows some keys that are in fact used somewhere. For example, all the "Templates." keys are listed here although they are used, because the are only referenced in the external template files which the addin knows nothing about.
    Because of this problem, I plan to add some filtering capabilities to this view so that you can filter out the "false positives" more easily.

    Resource keys can be deleted directly from this view by using the context menu or the delete button in the SharpDevelop toolbar after selecting one or more rows in the list. The keys are also deleted from the localized resource files if these are in the same directory as the main resource file. 

Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.