SlideShare a Scribd company logo
1 of 33
Brief Introduction to
Eclipse GEF (Part I)
Yongqiang
Outlines
•   What’s GEF?
•   Basic Concepts in GEF
•   Brief Introduction to Draw2d
•   Dive into a Real Case – How to draw a wafer and dies on it?
•   Summary
•   References
What’s GEF?
• Stands for Graphical Editing Framework
• A library to ease the task of building a graphical editor, in
  Eclipse




• Model – View – Controller Architecture
Samples
Basic Concepts
                    Interaction Layer
                    Model-to-View mapping
                    Workbench Integration
                    Rendering
                    Layout
                    Scaling

                    Native (SWT) Layer
GEF Components & Dependencies




                ui.views        GEF


           RCP
                     SWT   Draw2D

        Platform Runtime
Model                   View                  Controller

• Hold all data you   • Not hold any        • Make the link
  want to be edited     important data        between M and V
  by the users        • Know nothing        • In GEF, controllers
• Know nothing          about the model       are subclasses of
  about the view                              EditPart.
                      • Must be
• Must implement        completely dumb
  some kind of
  notification        • In GEF, view is
  mechanism             built with Draw2d
                        Figures
• Model Notification Mechanism




• Dumb View
• MVC Working Together
Brief Introduction to Draw2d
• a lightweight system of graphical components
• Its purpose is only to show things on the screen, not to hold
  and manipulate any data.
• Figures
• Painting of Figures




• Bounds of Figures
• Interesting features
  •   Layout Managers
  •   Hit-testing
  •   Events
  •   Predefined types of Figures
  •   Predefined types of Borders
  •   Connections
  •   Cursors and tooltips
  •   Layers
Dive into a Real Case –
How to draw a wafer and dies on it?




                                        Q: What is in
                                        your mind now?
                                        How to solve
                                        this problem?


                                      Die

                                Wafer
Maybe…
• We need to write a model to represent wafer, die and their
  relations.
• We need to write the view to represent them on screen to
  users.
• And also create subclasses of EditPart (controllers).
Model classes? Emm… seems easy!




                                  Just my own implementation.
                                  If you have better idea, let me
                                  know! 


           Q: What’s the relationship
           between Wafer and Die?
View classes (Let’s simplify it)
• A wafer is a round plate.
• A die is a square.
                         Ellipse                        RectangleFigure




                         If so, I believe there must be predefined figures
                         in draw2d to represent ellipse and rectangle!
The next is the subclasses of EditPart!
• Actually, we are going to use AbstractGraphicalEditPart (an
  abstract class which implements the interface of EditPart).
  a                 class org.eclipse.gef
                                      g

                                «abstract»
                         AbstractGraphicalEditPart

                     +    createEditPolicies() : void
                     +    createFigure() : IFigure




                          Q: What is createFigure() used
                          for?
                          Q: How to derive it and create the link
                          between model and view?
                          Q: How many subclasses do we need? 1 or
                          2?
We need 2! One for Wafer, the other is for Die.




                                      Cover this line first!

Return an Ellipse




                                Tell GEF what is my model children
Return an DieRectangleFigure, an
subclass of RectangleFigure
All classes are ready! How to integrate them into
Eclipse?
• In Eclipse, editing action happens in some Editors!
• We call such classes as EditorParts.
• Graphical editing action also happens there!
  G

      class org.eclipse.gef.editpart


                                                          EditorPart




                                                       GraphicalEditor

                                       +    setEditPartFactory(EditPartFactory) : void
                                       +    setRootEditPart(RootEditPart) : void




                                                                                            GraphicalViewer

                                                                                  +      setContents(Object) : void



         GraphicalEditorWithFlyoutPalette          GraphicalEditorWithPalette
Oh, many new classes!  See this sample




Palette   GraphicalEditor    GraphicalViewer
Data Flow                           Wait! the parameter is Object!
                                    How does GEF know it is a wafer object
Wafer Data                          and create WaferPart?




        GraphicalEditor




                      GraphicalViewer


                                                    Wafer View
                                    WaferPart
                                                     Die View


                                                DiePart
Let’s introduce EditPartFactory!




 EditoPartFactory will tell GEF the relationship between model classes
 and EditPart classes.
See the implementation…
Let’s create the Eclipse RCP App…
• Omit N words…
• Run it…

 Why are all dies
there?
Remember this feature?
So the covered line is…
Re-run the app…
Summary
• You should know…
  •   The basic concepts of GEF, draw2D and MVC archiecture
  •   How to write model, view and controller
  •   What GraphicalEditor and GraphicalViewer are.
  •   How to use EditorPartFactory
  •   How to use LayoutManager
• Next, in Part II, I will cover…
  •   how to add EditPolicy
  •   how to do notification?
  •   how to use EditDomain?
  •   How to add Tool and Commands?
  •   …
References
• GEF Main Page (http://www.eclipse.org/gef/)
• Good GEF tutorial (http://wiki.eclipse.org/GEF_Description,
  http://wiki.eclipse.org/GEF_Description2)
• Good Chinese GEF tutorial (
  http://liugang594.iteye.com/blog/152084,
  http://liugang594.iteye.com/blog/152086,
  http://liugang594.iteye.com/blog/152087)
Eclipse GEF (Part I)

More Related Content

Viewers also liked

Herramientas de sistema 160607010638
Herramientas de sistema 160607010638Herramientas de sistema 160607010638
Herramientas de sistema 160607010638ricardo721
 
Stratégie de la_bad_pour_la_période_2013-2022_-_au_centre_de_la_transformatio...
Stratégie de la_bad_pour_la_période_2013-2022_-_au_centre_de_la_transformatio...Stratégie de la_bad_pour_la_période_2013-2022_-_au_centre_de_la_transformatio...
Stratégie de la_bad_pour_la_période_2013-2022_-_au_centre_de_la_transformatio...Flore DIBI
 
The 9 Tallest Skyscrapers Being Completed in 2016
The 9 Tallest Skyscrapers Being Completed in 2016The 9 Tallest Skyscrapers Being Completed in 2016
The 9 Tallest Skyscrapers Being Completed in 2016Kenny Slaught
 
Final Portfolio without Resume in sheets
Final Portfolio without Resume in sheetsFinal Portfolio without Resume in sheets
Final Portfolio without Resume in sheetsJacqueline Reese
 
【J-SHIS】地震の発生確率と地震動の超過確率
【J-SHIS】地震の発生確率と地震動の超過確率【J-SHIS】地震の発生確率と地震動の超過確率
【J-SHIS】地震の発生確率と地震動の超過確率NIED
 
گزارش کسب و کارهای اینترنتی ایران
گزارش کسب و کارهای اینترنتی ایرانگزارش کسب و کارهای اینترنتی ایران
گزارش کسب و کارهای اینترنتی ایرانE-Commerce Monitor (ECM)
 
BDI- The Beginning (Big data training in Coimbatore)
BDI- The Beginning (Big data training in Coimbatore)BDI- The Beginning (Big data training in Coimbatore)
BDI- The Beginning (Big data training in Coimbatore)Ashok Rangaswamy
 

Viewers also liked (12)

Herramientas de sistema 160607010638
Herramientas de sistema 160607010638Herramientas de sistema 160607010638
Herramientas de sistema 160607010638
 
Ambiental SENA
Ambiental SENAAmbiental SENA
Ambiental SENA
 
Stratégie de la_bad_pour_la_période_2013-2022_-_au_centre_de_la_transformatio...
Stratégie de la_bad_pour_la_période_2013-2022_-_au_centre_de_la_transformatio...Stratégie de la_bad_pour_la_période_2013-2022_-_au_centre_de_la_transformatio...
Stratégie de la_bad_pour_la_période_2013-2022_-_au_centre_de_la_transformatio...
 
Opera vpn
Opera vpnOpera vpn
Opera vpn
 
The 9 Tallest Skyscrapers Being Completed in 2016
The 9 Tallest Skyscrapers Being Completed in 2016The 9 Tallest Skyscrapers Being Completed in 2016
The 9 Tallest Skyscrapers Being Completed in 2016
 
Final Portfolio without Resume in sheets
Final Portfolio without Resume in sheetsFinal Portfolio without Resume in sheets
Final Portfolio without Resume in sheets
 
【J-SHIS】地震の発生確率と地震動の超過確率
【J-SHIS】地震の発生確率と地震動の超過確率【J-SHIS】地震の発生確率と地震動の超過確率
【J-SHIS】地震の発生確率と地震動の超過確率
 
گزارش کسب و کارهای اینترنتی ایران
گزارش کسب و کارهای اینترنتی ایرانگزارش کسب و کارهای اینترنتی ایران
گزارش کسب و کارهای اینترنتی ایران
 
Array
ArrayArray
Array
 
BDI- The Beginning (Big data training in Coimbatore)
BDI- The Beginning (Big data training in Coimbatore)BDI- The Beginning (Big data training in Coimbatore)
BDI- The Beginning (Big data training in Coimbatore)
 
Mediosdetransmisin 160726172933
Mediosdetransmisin 160726172933Mediosdetransmisin 160726172933
Mediosdetransmisin 160726172933
 
Topologiasderedbryan 160816131256
Topologiasderedbryan 160816131256Topologiasderedbryan 160816131256
Topologiasderedbryan 160816131256
 

Similar to Eclipse GEF (Part I)

Gef tutorial 2005
Gef tutorial 2005Gef tutorial 2005
Gef tutorial 2005Ryan Wang
 
OOP, API Design and MVP
OOP, API Design and MVPOOP, API Design and MVP
OOP, API Design and MVPHarshith Keni
 
Shader Programming With Unity
Shader Programming With UnityShader Programming With Unity
Shader Programming With UnityMindstorm Studios
 
jQquerysummit - Large-scale JavaScript Application Architecture
jQquerysummit - Large-scale JavaScript Application Architecture jQquerysummit - Large-scale JavaScript Application Architecture
jQquerysummit - Large-scale JavaScript Application Architecture Jiby John
 
Conquering Gef Part 1: Effectively creating a well designed graphical editor
Conquering Gef Part 1: Effectively creating a well designed graphical editorConquering Gef Part 1: Effectively creating a well designed graphical editor
Conquering Gef Part 1: Effectively creating a well designed graphical editorVineet Sinha
 
Re-architecting visualisations in Java Swing
Re-architecting visualisations in Java SwingRe-architecting visualisations in Java Swing
Re-architecting visualisations in Java Swingmartinjgraham
 
Installing Games Sucks, Learn WebGL
Installing Games Sucks, Learn WebGLInstalling Games Sucks, Learn WebGL
Installing Games Sucks, Learn WebGLCorey Clark, Ph.D.
 
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...ICS
 
Professional JavaScript: AntiPatterns
Professional JavaScript: AntiPatternsProfessional JavaScript: AntiPatterns
Professional JavaScript: AntiPatternsMike Wilcox
 
CeedMath & CeedGL, Let's talk 3D...
CeedMath & CeedGL, Let's talk 3D...CeedMath & CeedGL, Let's talk 3D...
CeedMath & CeedGL, Let's talk 3D...rsebbe
 
GEF - Past, Present, and Future
GEF - Past, Present, and FutureGEF - Past, Present, and Future
GEF - Past, Present, and FutureAlexander Nyßen
 
Svcc Java2D And Groovy
Svcc Java2D And GroovySvcc Java2D And Groovy
Svcc Java2D And GroovyAndres Almiray
 
Java 8 selected updates
Java 8 selected updatesJava 8 selected updates
Java 8 selected updatesVinay H G
 
GMF : Create your graphical DSL - EclipseCon 11
GMF : Create your graphical DSL - EclipseCon 11GMF : Create your graphical DSL - EclipseCon 11
GMF : Create your graphical DSL - EclipseCon 11Chauvin Mariot
 
Mixing Diagram, Tree, Text, Table and Form editors to build a kick-ass modeli...
Mixing Diagram, Tree, Text, Table and Form editors to build a kick-ass modeli...Mixing Diagram, Tree, Text, Table and Form editors to build a kick-ass modeli...
Mixing Diagram, Tree, Text, Table and Form editors to build a kick-ass modeli...Chauvin Mariot
 
Design Patterns Illustrated
Design Patterns IllustratedDesign Patterns Illustrated
Design Patterns IllustratedHerman Peeren
 
elm-d3 @ NYC D3.js Meetup (30 June, 2014)
elm-d3 @ NYC D3.js Meetup (30 June, 2014)elm-d3 @ NYC D3.js Meetup (30 June, 2014)
elm-d3 @ NYC D3.js Meetup (30 June, 2014)Spiros
 

Similar to Eclipse GEF (Part I) (20)

Gef tutorial 2005
Gef tutorial 2005Gef tutorial 2005
Gef tutorial 2005
 
Solid OOPS
Solid OOPSSolid OOPS
Solid OOPS
 
OOP, API Design and MVP
OOP, API Design and MVPOOP, API Design and MVP
OOP, API Design and MVP
 
Shader Programming With Unity
Shader Programming With UnityShader Programming With Unity
Shader Programming With Unity
 
JavaFX in Action Part I
JavaFX in Action Part IJavaFX in Action Part I
JavaFX in Action Part I
 
jQquerysummit - Large-scale JavaScript Application Architecture
jQquerysummit - Large-scale JavaScript Application Architecture jQquerysummit - Large-scale JavaScript Application Architecture
jQquerysummit - Large-scale JavaScript Application Architecture
 
Conquering Gef Part 1: Effectively creating a well designed graphical editor
Conquering Gef Part 1: Effectively creating a well designed graphical editorConquering Gef Part 1: Effectively creating a well designed graphical editor
Conquering Gef Part 1: Effectively creating a well designed graphical editor
 
Re-architecting visualisations in Java Swing
Re-architecting visualisations in Java SwingRe-architecting visualisations in Java Swing
Re-architecting visualisations in Java Swing
 
Installing Games Sucks, Learn WebGL
Installing Games Sucks, Learn WebGLInstalling Games Sucks, Learn WebGL
Installing Games Sucks, Learn WebGL
 
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
 
Professional JavaScript: AntiPatterns
Professional JavaScript: AntiPatternsProfessional JavaScript: AntiPatterns
Professional JavaScript: AntiPatterns
 
CeedMath & CeedGL, Let's talk 3D...
CeedMath & CeedGL, Let's talk 3D...CeedMath & CeedGL, Let's talk 3D...
CeedMath & CeedGL, Let's talk 3D...
 
GEF - Past, Present, and Future
GEF - Past, Present, and FutureGEF - Past, Present, and Future
GEF - Past, Present, and Future
 
Svcc Java2D And Groovy
Svcc Java2D And GroovySvcc Java2D And Groovy
Svcc Java2D And Groovy
 
Java 8 selected updates
Java 8 selected updatesJava 8 selected updates
Java 8 selected updates
 
GMF : Create your graphical DSL - EclipseCon 11
GMF : Create your graphical DSL - EclipseCon 11GMF : Create your graphical DSL - EclipseCon 11
GMF : Create your graphical DSL - EclipseCon 11
 
Mixing Diagram, Tree, Text, Table and Form editors to build a kick-ass modeli...
Mixing Diagram, Tree, Text, Table and Form editors to build a kick-ass modeli...Mixing Diagram, Tree, Text, Table and Form editors to build a kick-ass modeli...
Mixing Diagram, Tree, Text, Table and Form editors to build a kick-ass modeli...
 
Design Patterns Illustrated
Design Patterns IllustratedDesign Patterns Illustrated
Design Patterns Illustrated
 
elm-d3 @ NYC D3.js Meetup (30 June, 2014)
elm-d3 @ NYC D3.js Meetup (30 June, 2014)elm-d3 @ NYC D3.js Meetup (30 June, 2014)
elm-d3 @ NYC D3.js Meetup (30 June, 2014)
 
OpenGL ES on iOS
OpenGL ES on iOSOpenGL ES on iOS
OpenGL ES on iOS
 

More from Yongqiang Li

How to Recognize Henry's Face
How to Recognize Henry's FaceHow to Recognize Henry's Face
How to Recognize Henry's FaceYongqiang Li
 
Introduction to Boost regex
Introduction to Boost regexIntroduction to Boost regex
Introduction to Boost regexYongqiang Li
 
Let's talk about java class loader
Let's talk about java class loaderLet's talk about java class loader
Let's talk about java class loaderYongqiang Li
 
Brief introduction to domain-driven design
Brief introduction to domain-driven designBrief introduction to domain-driven design
Brief introduction to domain-driven designYongqiang Li
 
Let's talk about java class file
Let's talk about java class fileLet's talk about java class file
Let's talk about java class fileYongqiang Li
 
Garbage Collection of Java VM
Garbage Collection of Java VMGarbage Collection of Java VM
Garbage Collection of Java VMYongqiang Li
 
Let's talk about jni
Let's talk about jniLet's talk about jni
Let's talk about jniYongqiang Li
 

More from Yongqiang Li (8)

Why Kotlin?
Why Kotlin?Why Kotlin?
Why Kotlin?
 
How to Recognize Henry's Face
How to Recognize Henry's FaceHow to Recognize Henry's Face
How to Recognize Henry's Face
 
Introduction to Boost regex
Introduction to Boost regexIntroduction to Boost regex
Introduction to Boost regex
 
Let's talk about java class loader
Let's talk about java class loaderLet's talk about java class loader
Let's talk about java class loader
 
Brief introduction to domain-driven design
Brief introduction to domain-driven designBrief introduction to domain-driven design
Brief introduction to domain-driven design
 
Let's talk about java class file
Let's talk about java class fileLet's talk about java class file
Let's talk about java class file
 
Garbage Collection of Java VM
Garbage Collection of Java VMGarbage Collection of Java VM
Garbage Collection of Java VM
 
Let's talk about jni
Let's talk about jniLet's talk about jni
Let's talk about jni
 

Recently uploaded

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 

Recently uploaded (20)

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

Eclipse GEF (Part I)

  • 1. Brief Introduction to Eclipse GEF (Part I) Yongqiang
  • 2. Outlines • What’s GEF? • Basic Concepts in GEF • Brief Introduction to Draw2d • Dive into a Real Case – How to draw a wafer and dies on it? • Summary • References
  • 3. What’s GEF? • Stands for Graphical Editing Framework • A library to ease the task of building a graphical editor, in Eclipse • Model – View – Controller Architecture
  • 5.
  • 6. Basic Concepts  Interaction Layer  Model-to-View mapping  Workbench Integration  Rendering  Layout  Scaling  Native (SWT) Layer
  • 7. GEF Components & Dependencies ui.views GEF RCP SWT Draw2D Platform Runtime
  • 8. Model View Controller • Hold all data you • Not hold any • Make the link want to be edited important data between M and V by the users • Know nothing • In GEF, controllers • Know nothing about the model are subclasses of about the view EditPart. • Must be • Must implement completely dumb some kind of notification • In GEF, view is mechanism built with Draw2d Figures
  • 9. • Model Notification Mechanism • Dumb View
  • 10. • MVC Working Together
  • 11. Brief Introduction to Draw2d • a lightweight system of graphical components • Its purpose is only to show things on the screen, not to hold and manipulate any data. • Figures
  • 12. • Painting of Figures • Bounds of Figures
  • 13. • Interesting features • Layout Managers • Hit-testing • Events • Predefined types of Figures • Predefined types of Borders • Connections • Cursors and tooltips • Layers
  • 14. Dive into a Real Case – How to draw a wafer and dies on it? Q: What is in your mind now? How to solve this problem? Die Wafer
  • 15. Maybe… • We need to write a model to represent wafer, die and their relations. • We need to write the view to represent them on screen to users. • And also create subclasses of EditPart (controllers).
  • 16. Model classes? Emm… seems easy! Just my own implementation. If you have better idea, let me know!  Q: What’s the relationship between Wafer and Die?
  • 17. View classes (Let’s simplify it) • A wafer is a round plate. • A die is a square. Ellipse RectangleFigure If so, I believe there must be predefined figures in draw2d to represent ellipse and rectangle!
  • 18. The next is the subclasses of EditPart! • Actually, we are going to use AbstractGraphicalEditPart (an abstract class which implements the interface of EditPart). a class org.eclipse.gef g «abstract» AbstractGraphicalEditPart + createEditPolicies() : void + createFigure() : IFigure Q: What is createFigure() used for? Q: How to derive it and create the link between model and view? Q: How many subclasses do we need? 1 or 2?
  • 19. We need 2! One for Wafer, the other is for Die. Cover this line first! Return an Ellipse Tell GEF what is my model children
  • 20. Return an DieRectangleFigure, an subclass of RectangleFigure
  • 21. All classes are ready! How to integrate them into Eclipse? • In Eclipse, editing action happens in some Editors! • We call such classes as EditorParts. • Graphical editing action also happens there! G class org.eclipse.gef.editpart EditorPart GraphicalEditor + setEditPartFactory(EditPartFactory) : void + setRootEditPart(RootEditPart) : void GraphicalViewer + setContents(Object) : void GraphicalEditorWithFlyoutPalette GraphicalEditorWithPalette
  • 22. Oh, many new classes!  See this sample Palette GraphicalEditor GraphicalViewer
  • 23. Data Flow Wait! the parameter is Object! How does GEF know it is a wafer object Wafer Data and create WaferPart? GraphicalEditor GraphicalViewer Wafer View WaferPart Die View DiePart
  • 24. Let’s introduce EditPartFactory! EditoPartFactory will tell GEF the relationship between model classes and EditPart classes.
  • 26. Let’s create the Eclipse RCP App… • Omit N words… • Run it…  Why are all dies there?
  • 28.
  • 29. So the covered line is…
  • 31. Summary • You should know… • The basic concepts of GEF, draw2D and MVC archiecture • How to write model, view and controller • What GraphicalEditor and GraphicalViewer are. • How to use EditorPartFactory • How to use LayoutManager • Next, in Part II, I will cover… • how to add EditPolicy • how to do notification? • how to use EditDomain? • How to add Tool and Commands? • …
  • 32. References • GEF Main Page (http://www.eclipse.org/gef/) • Good GEF tutorial (http://wiki.eclipse.org/GEF_Description, http://wiki.eclipse.org/GEF_Description2) • Good Chinese GEF tutorial ( http://liugang594.iteye.com/blog/152084, http://liugang594.iteye.com/blog/152086, http://liugang594.iteye.com/blog/152087)