Using content assist

In this section you will use content assist to finish writing a new method.

  1. Please make sure the VJET file Test.js is opened in your editor area.
  2. Please add a new method setClose() at the end of the props .

    The method is provided in the previous section: Adding New Methods.

  3. You can copy the following lines and insert them into setClose: function() method body. When you type the . after this, Eclipse will show a list of possible completions. Notice how the options are narrowed down as you continue to type.
    //> public void setClose()
    setClose: function() {
        if (!this.getBalance()) {
            vjo.sysout.println("Your account has been CLOSED!");
            this.setOpen(false);
        }
    }
    

    Content Assist

  4. With your cursor at the end of the word sys, press Ctrl+Space to activate content assist. The content assist window with a list of proposals will appear.

    Content assist

  5. With the content assist window still active, type the letter 'o' in the source code after sys (with no space in between). The list is narrowed and only shows entries starting with 'syso'.

    Content assist filtered

  6. Select sysout and press Enter. The code sysout is inserted.
  7. Do the same for println and complete the line so that it reads as follows:

    vjo.sysout.println("Your account has been CLOSED!");

  8. Save the file.

Related reference