What is a custom tool?

19 Mar.,2024

 

In this article

Custom tools let you associate a tool with an item in a project and run that tool whenever the file is saved. Certain custom tools, sometimes referred to as single-file generators, are frequently used to implement translators that generate code from data and vice versa. For example, single-file generators create Visual C# and Visual Basic source code out of the .settings and .resx files. The generated source code provides strongly-typed access to the data in the .settings and .resx files. The Visual C# and Visual Basic project types support custom tools; Visual C++ project types do not. Your own project types can also support custom tools.

Custom tools are registered components that implement the IVsSingleFileGenerator interface.

Custom tools are associated with a ProjectItem interface object, and are like designers and editors. A custom tool takes the file represented by a ProjectItem as input and writes a new file whose file name is provided by the DefaultExtension method.

In this section

Describes how to use the IVsSingleFileGenerator interface to implement a custom tool.

Provides descriptions for all the registry entries for a custom tool.

Explains how project systems provide support for visual designers to access generated classes and types through temporary portable executable (PE) files.

Shows how to persist a project item property, such as the author of a source file, in the project file.

Reference

IVsSingleFileGenerator Provides details about the IVsSingleFileGenerator, which transforms a single input file into a single output file that can be compiled or added to a project.

ProjectItem Explains the ProjectItem interface, which represents an item in a project.

DefaultExtension Provides details about the DefaultExtension method, which retrieves the file name extension that is given to the output file name.

Describes how to use Visual Studio projects and solutions to organize code files and resource files, and how to implement source control.

What is a Custom Tool?

What is a Custom Tool?

Tools are basic content elements that are used to create a design. Text, image, and button are some examples of our built-in tools. A custom tool can help you add more of these content elements to the editor. We know that every application is different and needs different tools to reach its full potential.

Every custom tool needs to have the following attributes to get running.

AttributeDescriptionNameA unique identifier string for your toolLabelA display label for your tool that the users will seeIconAn icon for your tool from a choice of 700+ icons or a custom imageSupported Display ModesDisplay mode this tool will work in (email, web or both)Usage LimitNumber of times a tool can be used in a single designRendererRenderer contains the content that the tool will create and exportPropertiesA set of variables that your tool will need to create content

Renderer

Renderer is where you define the content that your tool will create. This is done using a HTML template. Each renderer consists of a Viewer, Exporters and Head. In most cases, Viewer and Exporters contain the same HTML template but there are cases when these could be different.

Viewer

Viewer is the tool's template which will be visible to the user when they use your tool within the Unlayer editor.

Exporters

Exporters define the tool's HTML template which will be passed to your application when you call exportHtml. Depending on your supported display modes, each tool can have these 2 exporters:

  • Email
  • Web

This reflects what the output should be for each of the 2 display modes. HTML markup for email can be very different from a web page so this is where you can have the same tool working nicely for both display modes.

Head

Head is where you define any CSS or JavaScript that the tool will need to function. As the name says, these assets will be added to the <head></head> part of HTML. Learn more

Properties

Every tool needs certain properties to create content. Properties are variables that the user can modify, such as colors, font sizes, text alignment, images, and more.

Property Group

Property group is a collapsable panel that is used to organize properties into a group. This makes the experience of editing a template simpler and easier.

Property Editor

Each property is assigned a property editor which is a UI control widget used by the user to modify the property value. For example: color picker, slider, toggle, etc. We have many built-in property editors available, and you can also create a custom property editor.

What is a custom tool?

Overview

For more Low-Pressure Overmoulding Molding Process, Medical Device Rapid Prototyping, Rapid Tooling For Medical Devicesinformation, please contact us. We will provide professional answers.