0

I'm writing a plugin that needs to be notified as changes happen to open files in an Editor. This needs to happen in real time (similar to how syntax checking is done currently).

ResourceChangeEvents works when I only need to get notified when a file is saved.

IPropertyChangeListener will tell me when a editor is marked as dirty.

This question is similar, but is more geared to getting events on a single editor instance and won't scale well for all editors.

What about keypress notifications in an editor? I'm a little surprised they don't cause PropertyChange events. How can I get such notifications for all editors?

4

1 回答 1

1

您总是必须一次处理一个文本编辑器。您将创建一个org.eclipse.ui.IPartListener并开始在 partActivated 上收听编辑器,并在partDeactivated上停止收听编辑

另外,我认为您可能希望使用org.eclipse.jface.text.IDocumentListener来监听 ITextEditor 中的更改(而不是针对低级小部件本身)。

于 2013-06-18T12:55:18.777 回答