开发者

Eclipse Plugin - Text Editor - SingleLineRule

开发者 https://www.devze.com 2023-04-07 07:17 出处:网络
I\'ve been trying to develop my own text editor through a eclipse plugin. I would like just highlight some words in a text editor.

I've been trying to develop my own text editor through a eclipse plugin.

I would like just highlight some words in a text editor.

I wrote the following lines:

IToken xmlComment = new开发者_运维技巧 Token(TEXT_START);
new SingleLineRule("@st","art", textStart);

with these lines I have managed to highlight the word @start. But if I write any upper case letter is not longer highlighted.

It's any way to create a SingleLineRule with a regular expresion???

Thanks in advance!


I'm gonna answer my own question:

To create rules for "words" we can use the org.eclipse.jface.text.rules.WordRule Object, its constructor has as arguments the following objects:

word detector It's a implementation of IWordDetector

defaultToken The token itself

ignoreCase Of course a boolean value to ignore case.

Then to add the words just call the addWord method

myWordRule.addWord(myWord, myToken);

0

精彩评论

暂无评论...
验证码 换一张
取 消