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

常に、一度に 1 つのテキスト エディターで処理する必要があります。org.eclipse.ui.IPartListenerを作成し、 partActivated でエディターのリッスンを開始し、partDeactivatedでエディターのリッスンを停止します

また、おそらくorg.eclipse.jface.text.IDocumentListenerを使用して、(低レベルのウィジェット自体をターゲットにするのではなく) ITextEditor の変更をリッスンすることをお勧めします。

于 2013-06-18T12:55:18.777 に答える