How to Refactor a Method Signature in the DVT Eclipse IDE

Description

This video shows how you can easily add, remove and reorder the arguments of a function or task in the DVT Eclipse IDE.

This video was show using DVT 24.1.1

Transcript

Introduction

In the DVT IDE, you can easily add, remove, and reorder the arguments of a function or task.

Changing the Method Signature

  1. Place the editor cursor on a method name, either on its declaration or on a method call.
  2. Then right-click and go to Refactor, Change Method Signature, or simply press the Shift-Alt-C shortcut.
  3. In the dialog that pops up, click Add and specify the new argument's type, name, and the value to be used in existing calls.
  4. Use the up and down buttons to move the arguments.

Previewing the Changes

You can choose to preview the changes about to be performed or click OK to apply them.

Let's take a look at the preview.

Note that the changes will be performed both in the extern declaration and in the out-of-body implementation of the function, and all existing function calls will be updated as well.

Handling Overrides in Subclasses

Now let's take another example.

Note that this task has two overrides in UART monitor subclasses.

Let's remove one of its arguments.

Note that the signature change is reflected in all declarations across the whole object-oriented inheritance tree and in all the task calls as well.