changeKeywords

changeKeywords(action:      Integer;
               keywordList: Integer;
               keywords:    String);

The changeKeywords method of the JadeTextEdit class modifies one or more of the current keyword lists. The keyword lists are used by the current language lexical analyzer to classify the tokens found in the text. For the JADE language, this includes keywords, class names, constant names, and so on.

The value of the action parameter can be one of the JadeTextEdit class constants listed in the following table.

Class Constant Value Description
KEYWORDS_ADD 2 Adds the keywords specified in the keywords parameter to the list specified in the keywordList parameter.
KEYWORDS_DELETE 3 Deletes the words specified in the keywords parameter from the list specified in the keywordList parameter.
KEYWORDS_SET 1 Clears the list specified in the keywordList parameter then sets it to the words specified in the keywords parameter.
KEYWORDS_TOLANGDEF 4 Sets each keyword list to the default set of words for the current programming language. The value of the keywordList parameter must be zero (0).

Keyword list numbers are language-specific. JADE language keyword list numbers are the JadeTextEdit class constants listed in the following table.

Constant Value Constant Value
KWL_JADE_GLOBALCONSTANTS 5 KWL_JADE_IMPORTEDCLASSES 8
KWL_JADE_INTERFACES 9 KWL_JADE_KEYWORDS 1
KWL_JADE_METHODWORDS 2 KWL_JADE_PACKAGES 7
KWL_JADE_SYSTEMCLASSES 4 KWL_JADE_SYSTEMVARS 3
KWL_JADE_USERCLASSES 6    

Use the keywords parameter to specify keywords separated by spaces, tabs, Cr, Lf, or any combination of these separators.

The code fragments in the following examples show the use of the changeKeywords method.

jteSource.changeKeywords(JadeTextEdit.KEYWORDS_SET, 5, "");

jteSource.changeKeywords(JadeTextEdit.KEYWORDS_ADD, 8, "nine");
jteSource.changeKeywords(JadeTextEdit.KEYWORDS_DELETE, 8, "one");
jteSource.changeKeywords(JadeTextEdit.KEYWORDS_ADD, 8,
                              "five six seven two");
jteSource.changeKeywords(JadeTextEdit.KEYWORDS_DELETE, 8, "two seven nine");