Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Eclipse plugin development for CSU 670 course project, Selector language (Xaspect) editor plugin implementation.

Similar presentations

Presentation on theme: "Introduction to Eclipse plugin development for CSU 670 course project, Selector language (Xaspect) editor plugin implementation."— Presentation transcript:

1 Introduction to Eclipse plugin development for CSU 670 course project, Selector language (Xaspect) editor plugin implementation

2 What is Eclipse? Java VM Standard Java2 Virtual Machine Platform Eclipse Platform Java development tools JDTPDE Plug-in development environment - Eclipse is a universal platform for 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 –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 Text Editor  Framework(s) for building high-function text editors

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) –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  Framework for building rich graphical editors

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 HTML and XML based system Context-sensitive (F1) help Dynamic content generation Search engine Dynamic-aware Highly scalable (used on plugin.xml guide.xml Help UI User interface and dialogs Help Core API to access the documents  Help UI on top of an extensible help content model

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 to drive 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 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 A plug-in B class C interface I extension point P extension Typical arrangement contributes creates, calls implements

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 Extension point declaration – plugin.xml Extension declaration – plugin.xml  Declarative extensibility mechanism The extension-point defines the contract (markup and code) for the extensions Metaphor: disc spindle

19 A typical Plug-in Manifest

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(" ", 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; }

Download ppt "Introduction to Eclipse plugin development for CSU 670 course project, Selector language (Xaspect) editor plugin implementation."

Similar presentations

Ads by Google