1 / 47

Contributing to Eclipse:

Contributing to Eclipse:. Understanding and Writing Plug-ins. Tutorial Outline. Understanding the Contribution Cycle Introducing the technical side of Eclipse Using Eclipse to explore Eclipse Becoming an Extender Becoming an Enabler. Eclipse is an IDE framework. Is more than a Java IDE

wells
Download Presentation

Contributing to Eclipse:

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Contributing to Eclipse: Understanding and Writing Plug-ins

  2. Tutorial Outline • Understanding the Contribution Cycle • Introducing the technical side of Eclipse • Using Eclipse to explore Eclipse • Becoming an Extender • Becoming an Enabler

  3. Eclipse is an IDE framework • Is more than a Java IDE • ƒEclipse + JDT = Java IDE • Eclipse + CDT = C/C++ IDE • Eclipse + PHP = PHP IDE • Language Editor/Debugger/Refractor

  4. Eclipse is a Tools Framework • Tools extend the Eclipse platform using plug-ins • Business Intelligence and Reporting Tools (BIRT) • Eclipse Communications Framework (ECF) • Web Tools Project (WTP) • Eclipse Modelling Framework (EMF) • Graphical Editing Framework (GEF) • Test and Performance Tooling Project (TPTP)

  5. Eclipse is a Rich Client Platform

  6. Platform vs. Extensible Application

  7. Platform Implications • Everybody can contribute plug-ins • Every programmer can be a tool smith • Creating opportunities for further extension makes it possible for the tool smith to benefit from the work of others • It has to be easy to install and manage plug-ins

  8. Eclipse Involvements

  9. Eclipse Involvements • Users • Users of Eclipse • Extenders • Providers of extensions to existing extension points • Enablers • Providers of extension points others provide extensions for

  10. As an eclipse user • common user interface paradigm • Workbench • Views – navigation support, properties • Editors – edit files, e.g. Java Editor • Perspectives – arrangement of views and editors • Preference / Property – Global/Local settings • Hot Keys for Java developer • Ctrl+Shift T Find Type • Ctrl+Shift M Find Import • Ctrl+Shift F Format • Ctrl 1 Quick Fix

  11. Tutorial Outline • Understanding the Contribution Cycle • Introducing the technical side of Eclipse • Using Eclipse to explore Eclipse • Becoming an Extender • Becoming an Enabler

  12. Eclipse Plug-in Architecture • Plug-in – set of contributions • ƒ Smallest unit of Eclipse functionality • ƒ Big example: HTML editor • ƒ Small example: Action to create zip files • Extension point - named entity for collecting contributions • Example: extension point for workbench preference UI • Extension - a contribution • Example: specific HTML editor preferences

  13. Contribution Rule • Everything is a contribution. • Each plug-in • Contributes to 1 or more extension points • Optionally declares new extension points • Depends on a set of other plug-ins • Optionally contains Java code libraries and other files • May export Java-based APIs for downstream plug-ins • Lives in its own plug-in subdirectory • Theoretically unbound number of plug-ins

  14. Eclipse Plug-in Architecture • Allow for loading on demand by separating declaration and implementation: • Declaration of plug-in contributions • Describes plug-in functionality • Describes UI elements to present plug-in functionality • Used by the platform to render parts of the plug-in’s UI • Specifies implementation classes • Implementation of plug-in contributions • Implemented in Java and provided as Java archive • ƒIs loaded on demand

  15. Tip of the Iceberg • Startup time: O(#used plug-ins), not O(# installed plug-ins)

  16. Eclipse Plug-in Architecture • Plug-in details spelled out in the plug-in manifest • Manifest declares contributions • Code implements contributions and provides API • plugin.xml file in root of plug-in subdirectory

  17. Plug-in Manifest

  18. Eclipse Platform • Eclipse Platform is the common base • Consists of several key components

  19. Strata Rule • Separate core functionality from UI functionality. • Workspace Component • Workbench Component

  20. Workspace Component • Project – Folder – Files termed resources • ƒMeta data management: • Natures (e.g., Web, Java) • Markers • Incremental builders • Local history

  21. Workbench Component • SWT – generic low-level graphics and widget toolkit • JFace – UI frameworks for common UI tasks • Workbench – UI personality of Eclipse Platform

  22. SWT • A portable widget set • OS-independent API • Uses native widgets where available • Emulates widgets where unavailable • Supported platforms • Win32, WinCE • Linux/Motif, Solaris/Motif, AIX/Motif, HP-UX/Motif,… • QNX/Photon, Linux/GTK, • Mac OS X/Carbon

  23. JFace • UI framework built on top of SWT • Viewers • Model aware adapters for SWT widgets • Trees, tables, lists, styled text, .. • Dialog, Preference and Wizard frameworks • Actions • Location-independent user commands • Contribute action to menu, tool bar, or status line

  24. Workbench • Defines common user interface paradigm • Workbench • Views – navigation support, properties • Editors – edit files, e.g. Java Editor • Perspectives – arrangement of views and editors • Extended by contributing • Views, editors, preference pages, wizards, …

  25. Tutorial Outline • Understanding the Contribution Cycle • Introducing the technical side of Eclipse • Using Eclipse to explore Eclipse • Becoming an Extender • Becoming an Enabler

  26. Explore Eclipse with Eclipse • The Plug-in Development Environment • Explore a running Eclipse installation • Create a self-hosting workspace

  27. Plug-in Development Support

  28. Plug-in Development Environment • Extenders use PDE to implement plug-ins • PDE = Plug-in development environment • Specialized tools for developing Eclipse plug-ins • Built atop Eclipse Platform and JDT • Features • Specialized views to explore a running Eclipse installation • Specialized PDE editor for plug-in manifest files • Templates for new plug-ins • PDE runs and debugs another Eclipse workbench

  29. Available and Activated Plug-ins

  30. Self-hosting Workspace • PDE allows to import the plug-ins of a running Eclipse installation into an Eclipse workspace • Locate implementation class using plugin spy

  31. Self-hosting Workspace • ƒPlug-ins correspond to Java projects • Source projects “projects you are working on” • Binary projects “projects you are browsing only” • Source can be inspected

  32. Tutorial Outline • Understanding the Contribution Cycle • Introducing the technical side of Eclipse • Using Eclipse to explore Eclipse • Becoming an Extender • Becoming an Enabler

  33. Becoming an Extender • Contributions do not • Override existing behavior • Remove or replace existing components • Harm existing or future contributions

  34. Becoming an Extender • Create the Course Explorer plug-in • Import the business layer source to workspace • Declare and sketch the implementation of the Course Explorer View • Create a PDE launch configuration • Run the Course Explorer • Finalize the implementation

  35. Create a PDE launch configuration

  36. Viewer Details • Adapt domain model to a Viewer

  37. View Details

  38. Becoming an Extender • Another example: • Popup qualified Java class file Name and show java structure view • Step: • Create an eclipse plug-in project • Add dependencies(org.eclipse.jdt.core, org.eclipse.jdt.ui) • Copy qualified name of (org.eclipse.jdt.core.ICompilationUnit) • Add a popup extension. • Name with ~ShowJavaTreeViewAction~Testthe action • Create a tree view • Reuse JavaElementLabelProvider and StandardJavaContentProvier

  39. Tutorial Outline • Understanding the Contribution Cycle • Introducing the technical side of Eclipse • Using Eclipse to explore Eclipse • Becoming an Extender • Becoming an Enabler

  40. Tutorial Outline • Identify the scope of contributions to your plug-in • Declare the extension points • Implement the extension points • Consume the new extension points

  41. 作业 • 自行实现课堂上讲解的拼写检查的示例 • 提示:三个主要的类型: • SpellChecker/IDictionary/IWordIterator • 利用上述的组件,实现一个具有以下功能的Eclipse 插件: • 在PackageExplorer视图中选取一个文件,在右键菜单中增加OOADSpell Check菜单项。 • 选中后,根据选中文件的类型,选取适当的拼写检查器进行检查,并将检查的结果以表格的形式显示在一个名为Spell Check Result的视图中。表格包括两栏:错误单词和错误次数。

  42. 作业 • 需要支持对文本文件(.txt)和(.xml)文件的检查,XML文件检查时需要简单地忽略掉’<‘和’>’之间的内容(不必考虑特殊情况,如xml文件的格式错误)。 • 可选: • 对于有能力的同学,可以考虑定义扩展点,使得第三方开发者能够提供对其它文件格式的拼写检查的支持。 • 可参考的资料: • 示例 • Platform Plug-in Developer Guide(Eclipse Help) • The Official Eclipse FAQs: http://wiki.eclipse.org/The_Official_Eclipse_FAQs

  43. 作业讲解

  44. 主要问题 • 包含统计的概念 • 有些过度设计的内容 • 如包含了Project/Schedule • 依然有将用例和概念模型混杂在一起的情况 • 如包含执行任务/登录系统的概念

More Related