AbstractUIPlugin与Plugin的区别

来源:互联网 发布:centos 创建用户组 编辑:程序博客网 时间:2024/06/13 02:51

1.前者为UI提供支持,后者不是
2.前者在插件卸载关闭时会自动保存首选面值,后者不会,Plugin中的stop方法什么都没做,所以,如果要保存首选项持久化内容,就需要在stop方法里面自己去做保存工作。
这是两者最重要的区别
AbstractUIPlugin中的stop源码为:
    public void stop(BundleContext context) throws Exception {
        try {
            if (bundleListener != null) {
                context.removeBundleListener(bundleListener);
            }
            saveDialogSettings();
            savePreferenceStore();//自动保存
            preferenceStore = null;
            if (imageRegistry != null)
             imageRegistry.dispose();
            imageRegistry = null;
        } finally {
            super.stop(context);
        }
    }

 

 

原创粉丝点击