SlideShare ist ein Scribd-Unternehmen logo
1 von 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)

Weitere ähnliche Inhalte

Andere mochten auch

Final Portfolio without Resume in sheets
Final Portfolio without Resume in sheetsFinal Portfolio without Resume in sheets
Final Portfolio without Resume in sheets
Jacqueline Reese
 

Andere mochten auch (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
 

Ähnlich wie Eclipse GEF (Part I)

Gef tutorial 2005
Gef tutorial 2005Gef tutorial 2005
Gef tutorial 2005
Ryan Wang
 
Java 8 selected updates
Java 8 selected updatesJava 8 selected updates
Java 8 selected updates
Vinay 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 11
Chauvin Mariot
 
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
 

Ähnlich wie 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
 

Mehr von 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
 

Kürzlich hochgeladen

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
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
 
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
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 

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)