The Source Helper
The Source Helper is a handy feature that allows the developer to quickly write source without knowing all the method names of the classes that are being used. The Source Helper is available in the Edit Source panel, the Interaction Manager and the Source Window when developing Non Visual applications.
By default the Source Helper is activated in each of the three areas when JDesignerPro is first installed. To turn it on or off in each of these three areas simply press the Source Helper button shown here. When it is depressed the Source Helper is on. When it is not pressed the Source Helper is off.
Six ways of helping you
The Source Helper works in six ways to help you. These are as follows:
- Find a global variable or local method name
- List all methods that can be called for an instance of a variable
- List a selection of methods that can be called for an instance of a variable
- List all static methods that can be called for a class
- List a selection of static methods that can be called for a class
- List all methods that return a value of the selected type
Below is a detailed description of how each of these work.
Find a global variable or local method name
When you type the partial name of a global variable or local method and pause for 2 seconds the Source Helper list on the right of the source panel will load a list of all the global variables and methods that begin with the text that you have typed. If a match is found the focus will be switched the the Source Helper list. From here you can either press Shift Tab to get back to the source or use the up and down arrow keys to position to the one you want. Once you have selected the desired entry press Enter and it will be entered in the source for you and the cursor repositioned. This will save you from making typos in long method and variable names.
e.g. typing 'doc' in the source returns 3 different global variables and one method that all begin with 'doc'.
List all methods that can be called for an instance of a variable
After entering a global variable name, type a period and pause for 2 seconds. The Source Helper will load a list of the methods available for that variable. If any methods are found the focus will be switched to the the Source Helper list. From here you can either press Shift Tab to get back to the source or use the up and down arrow keys to highlight the entry you want. You can also type the first few characters of the method to locate it in a large list.
Once you have highlighted the desired entry, press Enter and it will be entered in the source for you with the cursor repositioned. The method and it's parameter types will be entered in the source. If there are parameters, the first parameter will be selected and the Source Helper will load a list of variables and methods that return a value matching this type. See 'List all methods that return a value of the selected type', below, for details on how this works. This will save you from making typos in long method names.
e.g. typing 'docNums.' in the source loads all the methods for this variable. In this example docNums is a Hash table so we see a list of the methods that belong to a Hash table and also the methods of the classes that a Hash table extends.
List a selection of methods that can be called for an instance of a variable
This feature works in exactly the same way as the one above except that instead of just typing a period after the variable name you would also type the first few characters of the method if you have an idea of what they are. After doing this the Source Helper operates in the same way as the 'List all methods that can be called for an instance of a variable', above.
e.g. typing 'docNums.ge" in the source loads all the methods for this variable that begin with 'ge'. In this example docNums is a Hash table so we see two methods, get(Object) and getClass();
List all static methods that can be called for a class
When you have entered a class name that has static methods such as JDPDate type a period immediately after it and pause for 2 seconds. The Source Helper will load a list of the static methods available for that class. If any methods are found the focus will be switched the the Source Helper list. From here you can either press Shift Tab to get back to the source or use the up and down arrow keys to position to the one you want. You can also type the first few characters of the method to locate it in a large list. Once you have selected the desired entry press Enter and it will be entered in the source for you and the cursor repositioned. The method and it's parameter types will be entered in the source. If there are parameters the first parameter will be selected and the Source Helper will load a list of variables and methods that return a value matching this type. See 'List all methods that return a value of the selected type', below, for details on how this works. This will save you from making typos in long method names.
e.g. typing 'JDPDate.' will return a list of all the static methods that belong to the JDPDate class.
List a selection of static methods that can be called for a class
This feature works in exactly the same way as the one above except that instead of just typing a period after the class name you would also type the first few characters of the method if you have an idea of what they are. After doing this the Source Helper operates in the same way as the 'List all static methods that can be called for a class' above.
e.g. typing 'JDPDate.unf' will return a list of all the static methods that belong to the JDPDate class that begin with 'unf'.
List all methods that return a value of the selected type
Any time you select a variable type in the source either using the Shift key and the arrow keys or using the mouse and then moving the mouse over the Source Helper list the Source Helper will load a list of the variables and their methods that have a matching return type to that selected in the source. If any methods are found the focus will be switched the the Source Helper list. From here you can either press Shift Tab to get back to the source or use the up and down arrow keys to position to the one you want. You can also type the first few characters of the method to locate it in a large list. Once you have selected the desired entry press Enter and it will be substituted at the point in the source where the data type was selected and the cursor repositioned. The method and it's parameter types will be entered in the source. If there are parameters the first parameter will be selected and the Source Helper will load a list of variables and methods that return a value matching this type in the same way as it just did.
e.g. After selecting a method from the Source Helper we see that it has a parameter of String that has already been selected.
after waiting a second we'll see a list of local methods and global and local variables and their methods that return a String.
at this point pressing Enter will substitute the method call for us as show here.