Using content assist

In this section you will use content assist to finish writing OCL expressions. Open the file testlib.oclx in the OCL editor if you do not already have it open and select the myTest test in the Outline view. If the file doesn't contain such a test see Adding new OCL Library content for instructions on how to add this test.

  1. Add the following line:

    expected class.ocl

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

    Content assist

  3. With the content assist window still active, type the letter 'i' in the source code after ocl (with no space in between). The list is narrowed and only shows entries starting with 'ocli'.

    Content assist filtered

  4. Select oclIsInvalid() from the list and press Enter. The code for the oclIsInvalid() method is inserted.
  5. Complete the line so that it reads as follows:

    expected class.oclIsInvalid() = false

  6. Save the file.

Related concepts

OCL editor

Related reference

OCL Editor Preferences