User Extensibility and Customization

    Custom Mappings Extensibility

    This approach allows VBUC users to specify customized mappings.  The users can decide which elements to transform and what transformation to apply. Even though only simple mappings are allowed in this solution, the capabilities of this feature have been enough for some VBUC clients to specify around 20,000 customized mappings on their own and apply them successfully.

    The custom mappings extensibility is even more powerful when combined with the development of custom helper classes. The helper classes can provide equivalent behavior when some functionality is not available in the target platform.

    Custom Maps Editor

    custom-maps-editor.gif

    The custom maps editor is implemented as a VBUC Plug-in. It can be found under the tools menu in the main window of the VBUC’s GUI.

    The controls placed on the editor provide the following functionalities:


    Download VBUC Free Trial
    Download VBUC Now

    It's time to eradicate VB6
    ROI of eradicating VB6

    8 Proven Tips for
    Planning a Successful Migration

    8 Tips for migration

    Action Icon Description
    New new-icon.gif

    Creating a New custom map configuration.
    When the user selects this option, he/she is prompted for a new configuration name and description.
     Figure 1. Input dialog for entering new custom maps file configuration name

     create-new-custom-map-file.gif

    Save save-icon.gif

    Saving the current map configuration

    Save As save-as-icon.gif

    Save the current configuration with a new name. When this option is selected, the user is prompted for a new name for the custom map configuration copy that will be created.

    enter-new-name.gif 
    Figure 2. Input dialog for new name

    Delete delete-icon.gif

    Delete the currently selected configuration. The user will be prompted for confirmation before actually removing the file.

    Writing a new Custom Map File

    Custom Maps are written for Types or Members.
    A Type is either:

    • a Class
    • a Form
    • a Module
    • an Enumeration

    And a Member is either:

    • Any Class Property, Sub or Function
    • Any Form Property, Sub or Function
    • Any Module Sub or Function
    • Any Enumeration’s Field

    A custom map applies for both references and declarations of the given element. In order to get familiarized with the custom maps editor some of the most used concepts are described below.

    References

    A reference is any use of a Type or a Member in your code. Examples of Type references are:

    [VB6]

    Dim x as Class1
    Sub foo(x as Class1)
    End Sub

    Examples of Member references are:

    [VB6]

    Sub Foo(x as Class1)
    x.Member1
    Dim a
    A = Enum1.Value1
    End Sub

    Declarations

    A declaration is the code segment where the element definition is located.

    Visibility

    The custom maps feature can change the visibility of a given element in the target code. The new visibility modifier can be set to:

    • Public
    • Private
    • Protected
    • Internal

    Target Return

    The target return is the data type for subs, properties and functions to be returned to the code flow path after the execution of this code segment. The user cannot change the type of an enum or any enum field.

    Note that if the user changes the return type of a function, it can result in some compilation errors.

    VB6 Project

    The VB6 argument of the custom maps editor is used if a multi-project upgrade is being performed, so the user can specify the particular project to apply the custom mappings in order to avoid name conflicts and to fine tune de transformations scope and precision.

    About removals

    Performing removals of code elements can have severe implications; it is not safe unless the code elements are not referenced by any other code segment in the current project, or in other VB6 projects if a multi-project upgrade is performed.

    Sub, Properties or Function removals

    This kind of removals can produce compilation errors if any of these elements are used or referenced. Also, if these element were part of a more complex statement like an If expression, the upgrade engine will remove the complete instruction, possibly deleting important code.

    Properties are removed as a whole code segment, which means that the user cannot specify to remove only the get or set of a property.

    Enumerations

    Removing enumeration elements can affect the values of the rest of the elements in the entire enumeration, which can affect the normal program execution flow.

    Using the Editor

    using-the-editor.gif

    The ComboBox in the top right corner allows you to change between current configurations. The custom map files are edited in a grid control. The user can navigate through the columns with the arrows keys.

    Grid Control Columns

    Column Name Description
    VB6 Project Name The particular VB6 project name should be specified here
    SourceName This is the “complete name” of a given element. The complete name has the following format: <Class/Module/Form/Enum name>.<Member name>
    MapType Choose between Member (default) or Type.
    New Reference Name Only set it if the user reference action is “Modify”. It’s the new name that will be used for all references
    Reference Action Choose between Leave, Modify or Remove
    New Declaration Name Only set it if the user declaration action is Modify. This will be used as the new name for the element declaration
    Declaration Action Choose between Leave, Modify or Remove
    Visibility Choose between Nothing (default), Public, Private, Protected or Internal
    Target Return This applies for Properties and Functions, and it changes the return type. This setting is ignored for Types and for enumeration fields