1 / 23

Introduction to Eclipse plugin development

Introduction to Eclipse plugin development. for CSU 670 course project, Selector language (Xaspect) editor plugin implementation. Plug-in development environment. Java development tools. Java VM. JDT. PDE. Platform. Eclipse Platform. Standard Java2 Virtual Machine.

nassor
Download Presentation

Introduction to Eclipse plugin development

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. Introduction to Eclipse plugin development for CSU 670 course project, Selector language (Xaspect) editor plugin implementation

  2. Plug-in developmentenvironment Java development tools Java VM JDT PDE Platform Eclipse Platform Standard Java2Virtual Machine What is Eclipse? • - Eclipse is a universal platformfor integrating development tools. • - Open, extensible architecture based on plug-ins

  3. UI Components • SWT - Standard Widget Toolkit • JFace – Framework providing higher-level UI abstractions • Workbench – Provides reusable and extensible UI metaphors • Text - Framework(s) for building high-function text editors • UI Forms - Framework for building forms-based views and editors • GEF - Framework for building rich graphical editors

  4. SWT - Standard Widget Toolkit  Platform-independent native widget toolkit

  5. JFace  Framework on top of SWT providing higher-level UI abstractions • Application window: menu bar, tool bar, content area & status line • Viewers (MVC pattern) • Actions, action bars (abstracts menu items, tool items) • Preference and wizard framework

  6. Workbench  Defines reusable and extensible UI metaphors Leverages extension point mechanism and JFace abstractions. Provides: • Views • Editors • Action sets • Perspectives: combination of Views and Editors -Wizards • Preference pages -Commands and Key Bindings -Undo/Redo support -Presentations and Themes -Activities (aka Capabilities) -… Is Dynamic-aware: responds to registry changes and adds/removes views, action sets, etc. accordingly

  7. Text Editor  Framework(s) for building high-function text editors • document infrastructure • text manipulation through text edits • positions and linked position manager • template support • projection (aka folding) support • source viewer framework • provides Text-, SourceViewer and SourceViewerConfiguration • concept of annotations, annotations painter, hovers • concept of content assist • incremental syntax coloring (presentation reconciler) • incremental outline update (model reconciler) • formatter infrastructure • text editor framework • leverages source viewer framework for use in workbench editors • provides AbstractTextEditor

  8. UI Forms • Form consisting of multiple FormParts • Extra widgets: • FormText (marked-up text) • ScrolledForm • Section • MasterDetailsBlock • Extra layouts: • TableWrapLayout (HTML-like) • ColumnLayout (newspaper-like) • Flat look, lightweight borders • Forms-based multi-page editor • Used extensively in PDE

  9. GEF (Graphical Editor Framework)  Framework for building rich graphical editors • Draw2D - structured graphics drawing framework • Graphical editor framework: • MVC architecture • Undo/Redo support • Palette and common tools for manipulating objects • Integration with Properties and Outline view

  10. User Assistance Components • Eclipse Help – Help UI on top of an extensible help content model • Intro support – Provides the “welcome experience” for your product • Cheat sheets – Provides guidance through complex tasks

  11. Eclipse Help  Help UI on top of an extensible help content model • HTML and XML based system • Context-sensitive (F1) help • Dynamic content generation • Search engine • Dynamic-aware • Highly scalable (used on ibm.com) Help UI User interface and dialogs Help Core API to access the documents guide.xml <toc label="Go wild user Guide"> <topic label="Getting Started"> <anchor id="gettingstarted"/> </topic> <topic label="Commands" href="doc/cmds.html"/> </toc> plugin.xml <extension point="org.eclipse.help.toc"> <toc primary=“true" file="doc/guide.xml"/> <toc file="doc/tipsAndTricks.xml"/> </extension>

  12. Eclipse Help

  13. Intro support • Provides the “welcome experience” for your product Full mode: Standby mode: • HTML / CSS or SWT / Forms based • Can run actions todrive the UI

  14. Cheat sheets • Guides the user through a series of complex tasks to achieve a goal • Content written in XML • Can run actions to drive the UI

  15. Eclipse Plug-in Architecture • Plug-in - smallest unit of Eclipse function • Example: the editor of our course project. • Extension point - named entity for collecting “contributions” • Example: extension point for workbench text editor. • Extension - a contribution • Example: extending the text editor to edit selector language with syntax highlighting and semantics checking.

  16. Eclipse Plug-in Architecture • Typical arrangement • Plug-in A • Declares extension point P • Declares interface I to go with P • Plug-in B • Implements interface I with its own class C • Contributes class C to extension point P • Plug-in A instantiates C and calls its I methods plug-in B plug-in A contributes extensionpoint P extension implements interface I class C creates, calls

  17. Eclipse Plug-in Architecture • Each plug-in • Contributes to 1 or more extension points • Optionally declares new extension points • Depends on a set of other plug-ins • Contains Java code libraries and other files • May export Java-based APIs for downstream plug-ins • Lives in its own plug-in subdirectory • 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

  18. Runtime: Extension / extension point model  Declarative extensibility mechanism The extension-point defines the contract (markup and code) for the extensions Extension point declaration – plugin.xml <extension-point id=“views” name=“Views” schema="schema/views.exsd”/> Metaphor: disc spindle Extension declaration – plugin.xml <extension id=“catalogView" point=“org.eclipse.ui.views”> <view name=“Catalog” icon=“icons/catview.gif” class=“com.acme.CatalogView”/> </extension>

  19. Plug-in identification Other plug-ins needed Location of plug-in’s code Declare contributionthis plug-in makes Declare new extension point open to contributions from other plug-ins A typical Plug-in Manifest plugin.xml <plugin id = “com.example.tool" name = “Example Plug-in Tool" class = "com.example.tool.ToolPlugin"> <requires> <import plugin = "org.eclipse.core.resources"/> <import plugin = "org.eclipse.ui"/> </requires> <runtime> <library name = “tool.jar"/> </runtime> <extension point = "org.eclipse.ui.preferencepages"> <page id = "com.example.tool.preferences" icon = "icons/knob.gif" title = “Tool Knobs" class = "com.example.tool.ToolPreferenceWizard“/> </extension> <extension-point name = “Frob Providers“ id = "com.example.tool.frobProvider"/> </plugin>

  20. The Text Editor Framework The text editor framework provides a model-independent editor that supports the following features: presentation and user modification of text standard text editing operations such as cut/copy/paste, find/replace support for context and pull-down menus visual presentation of text annotations in rulers automatic update of annotations as the user edits text presentation of additional information such as line numbers syntax highlighting content assist text outlining pages that show the hierarchical structure of the text context sensitive behavior hover support over rulers and text key binding contexts preference handling

  21. Syntax coloring in Text Editor Syntax coloring is provided in the platform text framework using a model of : • Damage, • Repair • reconciling. 

  22. Damage, repair, and reconciling • Damage: As the user modifies text in an editor, parts of the editor must be redisplayed to show the changes.  • Repair: A repairer must be able to derive all of the information it needs from a damage region in order to successfully describe the repairs that are needed for a particular content type. • Reconciling:describes the overall process of maintaining the presentation of a document as changes are made in the editor. 

  23. Rule Based Reconciling • public class MyRuleScanner extends RuleBasedScanner { • …. • public MyRuleScanner() { • IToken tagToken = new Token(new TextAttribute(TAG_COLOR)); • IToken commentToken = new Token(new • TextAttribute(COMMENT_COLOR)); • IRule[] rules = new IRule[2]; • rules[0] = new SingleLineRule("<myTag", "myTag>", tagToken); • rules[1] = (new EndOfLineRule("//", commentToken)); • setRules(rules); • } • } • ////// in subclass of SourceViewerConfiguration: • public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) { • PresentationReconciler reconciler = new PresentationReconciler(); • DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getTagScanner()); • reconciler.setDamager(dr, Document.DEFAULT_CONTENT_TYPE); • reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE); • return reconciler; • }

More Related