检查是否在eclipse插件开发中单击了保存按钮

检查是否在eclipse插件开发中单击了保存按钮

本文介绍了检查是否在eclipse插件开发中单击了保存按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试添加修饰符(例如,向文件中添加后缀)每当在当前打开的文件中单击保存按钮时,我都会进行搜索,但是很难找出它来了,这是我的代码

Im trying to add decorators (eg. adding a suffix to a file) Whenever a save button click happens within a file that is currently open, I search but is having a hard time figuring it out Heres my code

public void decorate(Object resource, IDecoration decoration) {

    if () //I'm having trouble with this check
    {
    decoration.addSuffix("--Modified");
    }
    }

我们将不胜感激

推荐答案

有一个IEditorPartListener可以侦听编辑器是否为脏(表示未保存或不脏)已保存,您需要获取对IEditorPart的引用并添加正确的侦听器,而不是可以根据需要装饰导航器。

There is an IEditorPartListener that listens to if editor is "dirty" meaning unsaved or not dirty meaning saved you need to get a reference to the IEditorPart and add the correct listener than you can decorate you navigator as you please.

这篇关于检查是否在eclipse插件开发中单击了保存按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 20:36