Search and change font attributes

From NOA Documentation Wiki

Jump to: navigation, search

Source http://ubion.ion.ag/mainForumFolder/noa_forum/0073


       SearchDescriptor searchDescriptor = new SearchDescriptor("YourWord");
       searchDescriptor.setIsCaseSensitive(true);
       ISearchResult searchResult = textDocument.getSearchService().findFirst(searchDescriptor);
       ITextRange textRanges = null;
       if(!searchResult.isEmpty()) {
            textRanges = searchResult.getTextRanges();
            ITextCursor cursor = textDocument.getTextService().getText().getTextCursorService().getTextCursor();
            cursor.gotoRange(textRanges[0],false);
            cursor.getCharacterProperties().setFontBold(false);
            cursor.getCharacterProperties().setFontItalic(true);
            cursor.getCharacterProperties().setFontSize(6);
       }                
Personal tools