Submit Search
Upload
使用Eclipse自定义扩展点
•
Download as PPT, PDF
•
1 like
•
739 views
T
tangyouhua
Follow
介绍了使用eclipse扩展点使用场景、工作机制,如何定义、使用扩展点、跟踪扩展变化和注意事项。
Read less
Read more
Technology
Report
Share
Report
Share
1 of 20
Download now
Recommended
Tf diseño de proyectos pd
Tf diseño de proyectos pd
AngelamAcevedoc
Creating Virtual Infrastructure
Creating Virtual Infrastructure
Jake Weston
12120541495e 24-2060-1
12120541495e 24-2060-1
alienuforesearch
Cuestionario Inf.
Cuestionario Inf.
GabyVega9412
Curso : Diseño de Proyectos - Grupo 102058 53 examen final
Curso : Diseño de Proyectos - Grupo 102058 53 examen final
edacevedog
Alberto torres [eja 2013] - notas
Alberto torres [eja 2013] - notas
Max Jefferson
Taller seguridad social tecnologia
Taller seguridad social tecnologia
samivera2001
Blog
Blog
Jaz Jativa
Recommended
Tf diseño de proyectos pd
Tf diseño de proyectos pd
AngelamAcevedoc
Creating Virtual Infrastructure
Creating Virtual Infrastructure
Jake Weston
12120541495e 24-2060-1
12120541495e 24-2060-1
alienuforesearch
Cuestionario Inf.
Cuestionario Inf.
GabyVega9412
Curso : Diseño de Proyectos - Grupo 102058 53 examen final
Curso : Diseño de Proyectos - Grupo 102058 53 examen final
edacevedog
Alberto torres [eja 2013] - notas
Alberto torres [eja 2013] - notas
Max Jefferson
Taller seguridad social tecnologia
Taller seguridad social tecnologia
samivera2001
Blog
Blog
Jaz Jativa
Proyecto 545
Proyecto 545
Lilliana Patricia Madrigal Alvarez
Psyching To Gain Power
Psyching To Gain Power
PAVAN CHOUDARY
Perú / Lima / Inés Sierra
Perú / Lima / Inés Sierra
El taller del artista
09.我的童年和兄弟姐妹
09.我的童年和兄弟姐妹
Liu Ming Tao
Keyboard And Mouse Events In Python
Keyboard And Mouse Events In Python
omar32almarri
Cert teaching Assist UTSA Sep 9 2004
Cert teaching Assist UTSA Sep 9 2004
Juan Gomez
TIC - Estadísticas y reflexión de porque no se utilizan
TIC - Estadísticas y reflexión de porque no se utilizan
Robinson Enrique Rincón Ramírez
Documento 27
Documento 27
Paho Gutierrez
Bazo
Bazo
Ronald Montes
Free UK UFO National Archives Documents
Free UK UFO National Archives Documents
alienuforesearch
Racsko Réka: The Role of Massive Open Online Course (MOOC) in The New Learnin...
Racsko Réka: The Role of Massive Open Online Course (MOOC) in The New Learnin...
Reka Racsko
12120520425e 24-2056-1
12120520425e 24-2056-1
alienuforesearch
Stephen Cannoo Business Analyst skills matrix v2.0
Stephen Cannoo Business Analyst skills matrix v2.0
Stephen Cannoo
NAM Q4a 2011 UAT Strategy Document v1 0
NAM Q4a 2011 UAT Strategy Document v1 0
David Crane
Clipper@datacon.2019.tw
Clipper@datacon.2019.tw
Wei-Yu Chen
廣宣學堂: 企業導入微服務實戰
廣宣學堂: 企業導入微服務實戰
Paul Chao
企業導入微服務實戰 - updated
企業導入微服務實戰 - updated
Paul Chao
企業導入微服務實戰 - updated
企業導入微服務實戰 - updated
Paul Chao
Angular 5 全新功能探索 @ JSDC2017
Angular 5 全新功能探索 @ JSDC2017
Will Huang
Mvc training
Mvc training
xioxu
Web请求异步处理和海量数据即时分析在淘宝开放平台的实践
Web请求异步处理和海量数据即时分析在淘宝开放平台的实践
mysqlops
TQC+ 程式語言 Python 05:函式
TQC+ 程式語言 Python 05:函式
neochen2701
More Related Content
Viewers also liked
Proyecto 545
Proyecto 545
Lilliana Patricia Madrigal Alvarez
Psyching To Gain Power
Psyching To Gain Power
PAVAN CHOUDARY
Perú / Lima / Inés Sierra
Perú / Lima / Inés Sierra
El taller del artista
09.我的童年和兄弟姐妹
09.我的童年和兄弟姐妹
Liu Ming Tao
Keyboard And Mouse Events In Python
Keyboard And Mouse Events In Python
omar32almarri
Cert teaching Assist UTSA Sep 9 2004
Cert teaching Assist UTSA Sep 9 2004
Juan Gomez
TIC - Estadísticas y reflexión de porque no se utilizan
TIC - Estadísticas y reflexión de porque no se utilizan
Robinson Enrique Rincón Ramírez
Documento 27
Documento 27
Paho Gutierrez
Bazo
Bazo
Ronald Montes
Free UK UFO National Archives Documents
Free UK UFO National Archives Documents
alienuforesearch
Racsko Réka: The Role of Massive Open Online Course (MOOC) in The New Learnin...
Racsko Réka: The Role of Massive Open Online Course (MOOC) in The New Learnin...
Reka Racsko
12120520425e 24-2056-1
12120520425e 24-2056-1
alienuforesearch
Stephen Cannoo Business Analyst skills matrix v2.0
Stephen Cannoo Business Analyst skills matrix v2.0
Stephen Cannoo
NAM Q4a 2011 UAT Strategy Document v1 0
NAM Q4a 2011 UAT Strategy Document v1 0
David Crane
Viewers also liked
(14)
Proyecto 545
Proyecto 545
Psyching To Gain Power
Psyching To Gain Power
Perú / Lima / Inés Sierra
Perú / Lima / Inés Sierra
09.我的童年和兄弟姐妹
09.我的童年和兄弟姐妹
Keyboard And Mouse Events In Python
Keyboard And Mouse Events In Python
Cert teaching Assist UTSA Sep 9 2004
Cert teaching Assist UTSA Sep 9 2004
TIC - Estadísticas y reflexión de porque no se utilizan
TIC - Estadísticas y reflexión de porque no se utilizan
Documento 27
Documento 27
Bazo
Bazo
Free UK UFO National Archives Documents
Free UK UFO National Archives Documents
Racsko Réka: The Role of Massive Open Online Course (MOOC) in The New Learnin...
Racsko Réka: The Role of Massive Open Online Course (MOOC) in The New Learnin...
12120520425e 24-2056-1
12120520425e 24-2056-1
Stephen Cannoo Business Analyst skills matrix v2.0
Stephen Cannoo Business Analyst skills matrix v2.0
NAM Q4a 2011 UAT Strategy Document v1 0
NAM Q4a 2011 UAT Strategy Document v1 0
Similar to 使用Eclipse自定义扩展点
Clipper@datacon.2019.tw
Clipper@datacon.2019.tw
Wei-Yu Chen
廣宣學堂: 企業導入微服務實戰
廣宣學堂: 企業導入微服務實戰
Paul Chao
企業導入微服務實戰 - updated
企業導入微服務實戰 - updated
Paul Chao
企業導入微服務實戰 - updated
企業導入微服務實戰 - updated
Paul Chao
Angular 5 全新功能探索 @ JSDC2017
Angular 5 全新功能探索 @ JSDC2017
Will Huang
Mvc training
Mvc training
xioxu
Web请求异步处理和海量数据即时分析在淘宝开放平台的实践
Web请求异步处理和海量数据即时分析在淘宝开放平台的实践
mysqlops
TQC+ 程式語言 Python 05:函式
TQC+ 程式語言 Python 05:函式
neochen2701
微服務架構 導入經驗分享 吳剛志 - Community Open Camp
微服務架構 導入經驗分享 吳剛志 - Community Open Camp
Andrew Wu
新浪微博平台与安全架构
新浪微博平台与安全架构
n716
Nodejs & NAE
Nodejs & NAE
q3boy
我們與Azure DevOps的距離
我們與Azure DevOps的距離
Edward Kuo
Angular 4 網站開發最佳實務 (Modern Web 2017)
Angular 4 網站開發最佳實務 (Modern Web 2017)
Will Huang
从林书豪到全明星 - 虎扑网技术架构如何化解流量高峰
从林书豪到全明星 - 虎扑网技术架构如何化解流量高峰
Scourgen Hong
广告技术部自动化测试介绍.pdf
广告技术部自动化测试介绍.pdf
bj_qa
开源应用日志收集系统
开源应用日志收集系统
klandor
基于Symfony框架下的快速企业级应用开发
基于Symfony框架下的快速企业级应用开发
mysqlops
Xpp
Xpp
drewz lin
Foundation of software development 1
Foundation of software development 1
netdbncku
Notes of jcip
Notes of jcip
Dai Jun
Similar to 使用Eclipse自定义扩展点
(20)
Clipper@datacon.2019.tw
Clipper@datacon.2019.tw
廣宣學堂: 企業導入微服務實戰
廣宣學堂: 企業導入微服務實戰
企業導入微服務實戰 - updated
企業導入微服務實戰 - updated
企業導入微服務實戰 - updated
企業導入微服務實戰 - updated
Angular 5 全新功能探索 @ JSDC2017
Angular 5 全新功能探索 @ JSDC2017
Mvc training
Mvc training
Web请求异步处理和海量数据即时分析在淘宝开放平台的实践
Web请求异步处理和海量数据即时分析在淘宝开放平台的实践
TQC+ 程式語言 Python 05:函式
TQC+ 程式語言 Python 05:函式
微服務架構 導入經驗分享 吳剛志 - Community Open Camp
微服務架構 導入經驗分享 吳剛志 - Community Open Camp
新浪微博平台与安全架构
新浪微博平台与安全架构
Nodejs & NAE
Nodejs & NAE
我們與Azure DevOps的距離
我們與Azure DevOps的距離
Angular 4 網站開發最佳實務 (Modern Web 2017)
Angular 4 網站開發最佳實務 (Modern Web 2017)
从林书豪到全明星 - 虎扑网技术架构如何化解流量高峰
从林书豪到全明星 - 虎扑网技术架构如何化解流量高峰
广告技术部自动化测试介绍.pdf
广告技术部自动化测试介绍.pdf
开源应用日志收集系统
开源应用日志收集系统
基于Symfony框架下的快速企业级应用开发
基于Symfony框架下的快速企业级应用开发
Xpp
Xpp
Foundation of software development 1
Foundation of software development 1
Notes of jcip
Notes of jcip
使用Eclipse自定义扩展点
1.
使用 eclipse 自定义扩展点 唐尤华 2013-12-10
2.
目录 • • • • • • • 扩展点机制的优点 使用场景 扩展点机制简介 定义扩展点 调用扩展点 跟踪扩展变化 注意事项
3.
扩展点机制的优点 • 模块化、提高重用性 • 减少插件耦合 •
扩展点类似 API ,还提供了其他好处 – 扩展点是动态的,可以延迟加载 – 可以利用 eclipse classLoader – 丰富的文档、工具
4.
使用场景 • 需要为其他插件提供功能接口 – 指定接口的参数 –
支持动态注册,无需重启 eclipse
5.
扩展点机制简介 扩展点工作时序图
6.
扩展点示例 • • • ToogleAssitantHand ler 使用扩展点机制 进行显示 EclipseAssistantRes igtry 负责管理 CharacterContributi on
注册 Contributor 插件提 供 CharacterContributi on 扩展,指定扩展 点需要的参数 IRender ,并完成绘 画层实现
7.
定义扩展点 • 使用插件清单编辑器( the
Extension Schema Editor )编辑
8.
扩展点定义示例—新建
9.
扩展点定义示例—文档 • 填写扩展点 相关的信息
10.
扩展点定义示例—定义 配置扩展点信息
11.
扩展点元素说明 • extension : –
指定了 point, id, name 。 – 提供通过 choice, sequence 包含自定义 属性。 • 新建自定义元素: – 支持 boolean, string, java, resource, identifier 类型的变量 – 指定 java 类型时,可以 指定插件必须继承或实 现的 java 类或接口
12.
扩展点元素说明(续) • 在 extension
中,可以添加 扩展点需要的自定元素 – 个数 – 类型 – 关系 choice (选项)或 sequence (序列) • 通过编辑器配置定义好的扩 展点信息保存在 .exsd 文件中
13.
调用扩展点—添加 • 定义好扩展点后,可以在插件新建向导里看到该扩展点 • 添加完成后,可以看到需要填写的参数:例如 systempoint_handler
14.
调用扩展点—创建对象 • 通过 eclipse
扩展点服务 ,可以取到感兴趣扩展: – 插件 id – 扩展点名称 • 通过 IConfigurationElement – 得到 contributor 填入的参 数、对象进行需要的处理
15.
调用扩展点—创建对象(续) • 默认调用构造函数不带参数 • 要传入初始化数据 –
类需要实现 IExecutableExtension 接口 – 在无参构造函数调用以后,会接着调用 IExecutableExtension#setInitializationData – 函数声明如下: public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException;
16.
跟踪扩展变化 • 增加、移除扩展时需要合理应对 – ExtensionTracker
负责检测扩展 registry 变化 • 第一次读取 registry 后,需要进行监听变化 使用: org.eclipse.core.runtime.dynamichelpers.ExtensionTracker 实现: org.eclipse.core.runtime.dynamichelpers.IExtensionChangeHandler public void addExtension(IExtensionTracker tracker, IExtension extension) public void removeExtension(IExtension extension, Object[] objects) 参考: IExtensionTracker#registerHandler, IExtensionTracker#registerObject
17.
跟踪扩展变化(续 1 ) •
注册扩展变化 handler IExtensionTracker tracker = PlatformUI.getWorkbench().getExtensionTracker(); IExtensionRegistry xregistry = Platform.getExtensionRegistry(); tracker.registerHandler(this, ExtensionTracker.createExtensionPointFilter( xregistry.getExtensionPoint(“my.extension.point.id”))); • 注册 object CharacterContribution character = ...; IExtensionTracker tracker = PlatformUI.getWorkbench().getExtensionTracker(); tracker.registerObject( character.getConfigurationElement().getDeclaringExtension(), character, IExtensionTracker.REF_STRONG); • 处理变化 public void addExtension(IExtensionTracker tracker, IExtension extension) { ... } public void removeExtension(IExtension extension, Object[] objects) { ... }
18.
跟踪扩展变化(续 2 ) •
请记住: – registry 变化时要从缓存中删除 – 下一次访问时从 Extension Registry 重新加载 • 动态加载很简单,请使用动态加载! – 搜索 IExtensionChangeHandler 示例 • 注意 SWT 线程问题: – 为 UI Contribution 调用 PlatformUI.getWorkbench().getExtensio nTracker() 跟踪变化
19.
注意事项 • 什么时间读取 registry –
不要在启动时读取 – 尽可能延迟读取 • 在第一次访问时初始化 registry reader – 监听 registry 变化 • 在使用时才读取 contribution • 缓存扩展点 contribution ,在 registry 变化 时更新缓存 • 关闭插件时清理扩展点
20.
谢谢!
Download now